PHP 7.0 is the latest stable release of PHP. In this article we will help you to install PHP 7 on Ubuntu systems using PPA.
Login to your server as root.
Use the following command to make sure all packages are up to date.
apt-get update –y
Add Ondrej PPA and do apt-get update again:
add-apt-repository ppa:ondrej/php apt-get update
Now finally you can install PHP 7 using command below :
apt-get install php7.0 –y
You may also need to install several PHP modules, you can list them by using below command:
apt-cache search php7-*
Here’s the command to install PHP modules which are usually needed by many apps:
apt-get install php7.0-common libapache2-mod-php7.0 php7.0-cgi php7.0-cli php7.0-phpdbg php7.0-fpm libphp7.0-embed php7.0-dev php7.0-dbg php7.0-curl php7.0-gd php7.0-imap php7.0-interbase php7.0-intl php7.0-ldap php7.0-mcrypt php7.0-readline php7.0-odbc php7.0-pgsql php7.0-pspell php7.0-recode php7.0-tidy php7.0-xmlrpc php7.0 php7.0-json php-all-dev php7.0-sybase php7.0-modules-source php7.0-sqlite3 php7.0-mysql php7.0-opcache php7.0-bz2
Finally, we can verify it using php -v command:
php –v
Congratulations! You have successfully install the php 7.