In this tutorial, we will show you how to install and configuration of PHP 7 on your Ubuntu 15.04 server. For those of you who didn’t know, PHP (PHP: Hypertext Preprocessor) is a server-side scripting language designed for web development but also used as a general-purpose programming language. PHP code is interpreted by a web server with a PHP processor module, which generates the resulting web page: PHP commands can be embedded directly into an HTML source document rather than calling an external file to process data. PHP 7 comes with numerous new and improved features. One of the most noticeable is the new Zend Engine version. Also, other important improvements are enhanced performance and significantly reduced memory usage. Thus, PHP 7 can be up to twice as fast as PHP 5.6.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation PHP 7 in Ubuntu 15.04 server.
Install PHP 7 on Ubuntu 15.04
Step 1. First of all, make sure that all packages are up to date.
apt-get update apt-get upgrade
Step 2. Add the PPA (Personal Package Archive) repository for PHP 7 in your system.
sudo apt-get install python-software-properties sudo add-apt-repository ppa:ondrej/php-7.0
Now, install PHP 7 using the following command:
sudo apt-get update sudo apt-get install -y php7.0
Your server should restart Apache automatically after the installation of PHP. If it doesn’t, execute this command:
service apache2 restart
Step 3. Verify the Install PHP version.
Once it is completed, you can ensure that the latest stable release of PHP 7 is installed on your system by using the command:
# php -v PHP 7.0.0 (cli) (built: Dec 27 2015 20:42:32) ( NTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
Step 4. Install PHP modules.
If you like to search all the available PHP 7 modules you can use to command:
sudo apt-cache search php7-*
You may want to install some other PHP extensions required by your applications. Here is the list:
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
Step 5. Testing PHP 7 on Ubuntu 15.04
To test PHP, create a test file named info.php with the content below. Save the file, then browse to it to see if PHP is working:
<?php phpinfo(); ?>
Congratulations! You have successfully installed PHP 7. Thanks for using this tutorial for installing PHP 7 on your Ubuntu 15.04 system. For additional help or useful information, we recommend you to check the official PHP website.