I just deployed a new droplet. By default, it’s set up with PHP 5.5.9. I would like to upgrade that to v.5.6.
How do I do this?
Thanks in advance.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php5.6 php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml sudo a2dismod php5 sudo a2enmod php5.6 sudo service apache2 restart
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:
Though remember to be careful when doing an upgrade of PHP outside of the normal distro repositories, some of the additional modules that you might rely on could be missing for that version.
sudo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install -y 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 php5.6-zip libapache2-mod-php5.6
sudo a2dismod php5 sudo a2enmod php5.6 sudo service apache2 restart
I followed your instructions but keep getting E: Couldn’t find any package by regex ‘php5.6’
How to fix this?
I have an eCommerce site set-up and running on my DO droplet. I want to upgrade this software however, upgrade requirements state that I should also upgrade to PHP 5.6. While it’s not clear as to why this software now needs PHP 5.6, I did notice an issue with how my droplet reports which version of PHP it’s using.
I now see “PHP Version 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1” when hitting my phpinfo.php page. However, when I invoke “php -v” on the command line, I see: PHP 7.0.8-4+deb.sury.org~trusty+1 (cli) ( NTS ).
I believe 5.5.x, 5.6.x, and 7.0.x versions of PHP can all live together on the same server, how do I ensure Apache is serving up my site with a non-deprecated version of PHP 5.6?
Please note that phpinfo shows my loaded configuration file is /etc/php5/apache2/php.ini so that seems correct.
LAMP stack versions:
Is there an easier way to enforce which version of PHP my server utilizes?
Thank you, _rs
note that if you are using NGINX and not Apache, this needs to be changed to avoid apache being loaded as part of the install. According to the maintainer of the ppa, the correct approach is to replace
sudo apt-get install php5
with
sudo apt-get install php5 php5-fpm
in the provided sequence of commands
I’m using NGINX and I’m facing this problem too
I have a problem as I updated my php version to 5.6 from 5.5. Server:
I have done the following steps:
After that, I checked oci8 extensions:
But the following errors occurs when I load my web on the browser. 2017-01-09 20:13:54] production.ERROR: exception ‘Symfony\Component\Debug\Exception\FatalErrorException’ with message ‘Call to undefined function Yajra\Pdo\oci_connect()’ in /var/www/****/vendor/yajra/laravel-pdo-via-oci8/src/Pdo/Oci8.php:449
How to solve this problem? Is there any idea, please…
I am using NGINX but in the info.php the version is: 5.5.9
and in the cli I have: php-fpm5.6 and php-fpm ¿how do I choose the correct version to load with nginx?
take a closer look to my solution described in my recent answer to this question: https://www.digitalocean.com/community/questions/ubuntu-14-04-php-version-upgraded-from-5-5-9-to-5-6-phpinfo-still-shows-5-5-9-php-v-shows-5-6-uninstalling-5-5-9?answer=30429