Upgrade php 5.5.* to php 5.6.* using apt-get

旧时模样 提交于 2019-12-19 10:52:33

问题


I installed a new local server, when I installed php5 package with apt-get install php5 it got the version 5.6.

My production server is still with php 5.5 and I would like to upgrade it to php 5.6 like in my dev environment.

Can I do it easily using apt-get ? tell to apt-get to switch to the branch 5.6 ?

Thx


回答1:


Enter the following commands in the order shown:

apt-get -y update
add-apt-repository ppa:ondrej/php
apt-get -y update

apt-get -y install php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl

Enter the following command to verify PHP 5.6 installed properly:

php -v

Following is a sample response that indicates PHP 5.6 is installed:

PHP 5.6.22-4+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Done+




回答2:


To upgrade to a newer version of PHP 5.6 on Ubuntu 14.04, you can use Ondřej Surý's PPA. He is one of the Debian maintainers of the php5 package. To add the PPA and upgrade your packages, run:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5



回答3:


For PHP 5.6

sudo add-apt-repository ppa:ondrej/php5-5.6

For PHP 5.5

sudo add-apt-repository ppa:ondrej/php5

Reference




回答4:


I know that it's a little late to answer this question , but for anyone like me who is confused when upgrading php , I should say please note that before installing new version of php remove it completely from your system, even remove config files and extensions, It caused me so many errors and problems.

 sudo apt-get purge php.*
 sudo rm -rf /etc/php5
 sudo apt-get install software-properties-common
 sudo add-apt-repository ppa:ondrej/php5-5.6
 sudo apt-get update
 sudo apt-get upgrade
 sudo apt-get install php5


来源:https://stackoverflow.com/questions/36568374/upgrade-php-5-5-to-php-5-6-using-apt-get

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!