Install PHP 7.0 on Ubuntu Systems. Terminal commands to install and configure PHP7 on Ubuntu 16.04, via PPA. Install PHP7 Modules on Ubuntu 16.04 Systems. PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.
Install PHP 7 On Ubuntu
Run the following commands to install PHP 7 in Ubuntu systems.
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.0
You can also install PHP, Apache support, and MySQL support alongside PHP7:
sudo apt-get install php7.0 php-pear libapache2-mod-php7.0 php7.0-mysql
Similar to the above commands, one can also install additional cURL, JSON, and CGI support:
sudo apt-get install php7.0-curl php7.0-json php7.0-cgi
Once PHP7.0 is installed, run the command php -v to see the version of PHP7 installed:
Install PHP 7 Modules
There are various PHP modules that can be installed based on the application requirements. To install the necessary PHP modules, first search for all the available PHP modules. Run the following command to find our available php 7 modules.
sudo apt-cache search php7-*
List of Available PHP 7 Modules
php7.0-common – Common files for packages built from the PHP source
libapache2-mod-php7.0 – server-side, HTML-embedded scripting language (Apache 2 module)
php7.0-cgi – server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli – command-line interpreter for the PHP scripting language
php7.0-phpdbg – server-side, HTML-embedded scripting language (PHPDBG binary)
php7.0-fpm – server-side, HTML-embedded scripting language (FPM-CGI binary)
libphp7.0-embed – HTML-embedded scripting language (Embedded SAPI library)
php7.0-dev – Files for PHP7.0 module development
php7.0-dbg – Debug symbols for PHP7.0
php7.0-curl – CURL module for PHP
php7.0-gd – GD module for PHP
php7.0-imap – IMAP module for PHP
php7.0-intl – Internationalisation module for PHP
php7.0-ldap – LDAP module for PHP
php7.0-pgsql – PostgreSQL module for PHP
php7.0-pspell – pspell module for PHP
php7.0-recode – recode module for PHP
php7.0-snmp – SNMP module for PHP
php7.0-tidy – tidy module for PHP
php7.0-json – JSON module for PHP
php-all-dev – package depending on all supported PHP development packages
php7.0-sybase – Sybase module for PHP
php7.0-modules-source – PHP 7.0 modules source package
php7.0-sqlite3 – SQLite3 module for PHP
php7.0-mysql – MySQL module for PHP
php7.0-opcache – Zend OpCache module for PHP