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
Is that possible to install it on current Ubuntu version?
Is there any current limitations or known compatibility issues?
You can do the following:
Optionally purge PHP 5:
Or directly purge it including configuration files:
And finally install PHP 7:
Optionally clean up unneeded packages afterwards:
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:
Or
You have two options:
Wait until there is a new Ubuntu release that includes PHP7
Ubuntu won't release major new version releases to most software to existing Ubuntu versions; to get a major new version release you would need to wait until a newer version of Ubuntu.
Install a third-party version, such as from a PPA
PPAs are not bound by the release schedules or policies of Ubuntu so they are free to change versions more frequently, among other things. The PPA mentioned in Tshilidzi Mudau's answer is a popular way of staying more up to date with PHP.
PPAs don't come with the same official Ubuntu support as Ubuntu-supplied versions, and due to different schedules and policies may be of a different quality or security standard. In this case, the developer who makes this PPA available is well-known to the community here.
Here is my list of commands to fully update PHP with its dependencies, including phpMyAdmin (full LAMP stack):
Now you have PHP7. Let's go for phpMyAdmin: (start here if you have already PHP7 installed)
For Ubuntu 16.04, PHP7 is now the default official upstream version.
Here's a handy guide for setting up a LAMP stack on 16.04.
The above process did not work for my Ubuntu 15.10 server so I thought I would share what did work in case others find it helpful.
First I had to remove certain key PHP 5 modules:
Then remove a few extra things that were left behind:
Then install PHP 7.0:
Then as PHPMyAdmin was removed Apache2 wouldn't start so I had to remove the config file (I could have moved it instead):
Then I had to restart Apache2:
PHP 7.0 was then running (confirmed with
PHPINFO();
)However I have found the only way to get PHPMyAdmin working is to install/upgrade it manually as otherwise the latest version available in the sources doesn't support PHP 7 yet.
**EDIT: I have now found a way to get PHPMyAdmin updated to a compatible version without having to clone from GIT or compile manually from sources so I am adding this below:
First add this repository, update sources list and upgrade (NB: if it has been removed during the upgrade to PHP7 you will need to install rather than upgrade it):
However during installation (on my server) it had to run a database upgrade script
upgrade_column_info_4_3_0+.sql
but this failed with the following error:I chose to ignore the error and complete the upgrade. After installation I opened the .sql upgrade script at
/usr/share/phpmyadmin/sql/upgrade_column_info_4_3_0+.sql
I ran the script manually removing the two offending lines trying to create 2 columns that already existed (code to remove):
Finally I had to edit the config file at
/etc/phpmyadmin/config.inc.php
and add the following two lines:After this PHPMyAdmin is successfully updated and the extended features are enabled. Hope this helps others.
At the time of this answer (February 2017), on Ubuntu 16.04 LTS, it is now possible to install php 7.0.* with the simple command:
No need to add any third-party repositories.
I think the
ppa
has been added in 16.04 LTS.sudo apt-get install php7.0
and that's it.php --version
info.php
file in Apache's document root./var/www/html/
directorysudo gedit /var/www/html/info.php
<?php phpinfo(); ?>
. Note: the file is a blank file since you created it yourself.sudo service apache2 restart
http://localhost/info.php
that will give you full info about php.Hope this helps :)
I've collected a few different resources and resolved many issues to fully setup a build of PHP 7 on Ubuntu 15.04 and 15.10. Although it isn't a Debian package script, it does setup Ubuntu dependencies and configuration. The resources can be found over here.
You may need to select a release branch over just master and rerun the script.
I know that this may be a bad idea, but this is how I got php7 to work with my installation of Ubuntu Server 12.04.5 (i386):
Then append the following at the end:
Then update as you normally would:
Once you have PHP 7 installed on your apache server, you may have to move your files to a new directory to work: