Tuesday, March 20, 2018

php7 - How to install PHP 7?



PHP 7 came out yesterday and I would like to give it a try.




PHP 7.0.0 comes with a new version of the Zend Engine, numerous improvements and new features such as





  • Improved performance: PHP 7 is up to twice as fast as PHP 5.6

  • Significantly reduced memory usage

  • Abstract Syntax Tree

  • Consistent 64-bit support

  • Improved Exception hierarchy

  • Many fatal errors converted to Exceptions

  • Secure random number generator

  • Removed old and unsupported SAPIs and extensions

  • The null coalescing operator (??)

  • Return and Scalar Type Declarations


  • Anonymous Classes

  • Zero cost asserts



php.net







Is that possible to install it on current Ubuntu version?




Is there any current limitations or known compatibility issues?



You can do the following:



sudo apt-get install python-software-properties software-properties-common
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update



Optionally purge PHP 5:



sudo apt-get remove php5-common -y


Or directly purge it including configuration files:



sudo apt-get purge php5-common -y



And finally install PHP 7:



sudo apt-get install php7.0 php7.0-fpm php7.0-mysql -y


Optionally clean up unneeded packages afterwards:



sudo apt-get --purge autoremove -y



Alternatively, you can install PHP 7.0 from sources using this script script or following instruction on this blog.



EDIT:



PHP5 has now been replaced with PHP7 as the default PHP in Ubuntu 16.4 so, to install PHP7 on Ubuntu 16.04:



sudo apt-get install php7.0 


Or




sudo apt-get install php

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...