There isn't any significative reason why not to upgrade your servers to PHP 7 if you are running vanilla versions, for instance of Joomla!, for the sake of listing one major dweller in the LAMP landscape.
PHP 7 vs 5.6 has no major differences in the language itself; but V7 dropped deprecated stuff, and brought up a lot of controversies among the community, by the way.
If you are interested into delving deeper on the topic, please follow this link for a comprehensive benchmark of PHP 7 vs other versions, PHP Benchmarks, and keep reading down the comments on Sitepoint.
Joomla!, for example, on its PR post for the 3.5 release says:
PHP 7 Suppport. Make Joomla! at least 2X faster with half the memory on systems that run PHP 7.
But upgrading to PHP 7, though, requires some work for the SysAdmin while the major Linux distributions provide a LAMP install workflow with all the elements you will require for running complex applications.
Setting up the environment
- Add the PPA to your environment
sudo add-apt-repository ppa:ondrej/php
Don't forget to paid a visit to https://deb.sury.org/pages/donate.html to thank him for such a valuable work 8-)
- Update your Operating System to include new PPA
sudo apt-get update
Optionally, but good idea to do…
sudo apt-get upgrade
Installing PHP 7
Assuming you are upgrading on top of a working system,
- Install PHP 7
sudo apt-get install php7.0
- If you are using Apache2, then install PHP7 module for Apache2
sudo apt-get install libapache2-mod-php7.0
- If you are getting the full LAMP stack, then install MySql module
sudo apt-get install php7.0-mysql
- Test
sudo service apache2 restart
php -v
Your Console should output something similar to the following:
PHP 7.0.5-2+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
But, it doesn't mean that your Apache thinks the same as your CLI, so create a phpinfo() file to verify that PHP 7 is actually what Apache is loading as well. PHP 7 Fine tuning & Modules
As you now have a new environment running PHP7, your previous setup is not longer available, so maybe you will have to:
- Set Include Paths if needed
sudo vim /etc/php/7.0/apache2/php.ini
- Install the GD module
sudo apt-get install php7.0-gd
- Install mCrypt
sudo apt-get install mcrypt php7.0-mcrypt
- Install CUrl
sudo apt-get install php-curl
- Caching
APC, Memcache, Varnish???
At least APC is very good idea to have.
- Restart Apache and run your phpinfo() again
sudo service apache2 restart
- Switching between PHP versions
Just in case you may need to failover to your previous PHP version, and assuming you are upgrading from PHP5.6, you can flip between versions by,
sudo a2dismod php5.6
sudo a2enmod php7.0
sudo service apache2 restart
1) If your sites use third-party components, reach out to the Vendor for advice before investing your time doing the switch
Moisés Jafet Cornelio-Vargas
About Moisés
Physicists, award-winning technologist, parallel entrepreneur, consultant and proud father born in the Dominican Republic.
Interested in HPC, Deep Learning, Semantic Web, Internet Global High Scalability Apps, InfoSec, eLearning, General Aviation, Formula 1, Classical Music, Jazz, Sailing and Chess.
Founder of pluio.com and hospedio.com.
Author of the Sci-fi upcoming novel Breedpeace and co-author in dozens of publications.
Co-founder of MunicipiosAlDia.com, Jalalio Media Consultants and a number of other start-ups.
Former professor and Key-note speaker in conferences and congresses all across the Americas and Europe.
Proud member of the Microchip No.1 flying towards Interestellar space on board NASA's Stardust Mission, as well as member of Fundación Municipios al Día, Fundación Loyola, Fundación Ciencias de la Documentación and a number of other non-for profit, professional organizations, Open Source projects and Chess communities around the world.
All opinions here are his own's and in no way associated with his business interests or collaborations with third-parties.