PHP7 Installation

by | Aug 8, 2016 | Featured, Important, Linux, Server Administration | 0 comments

Recent days have seen support end for PHP5.5. That mean there will be no more security patches or updates. So many system admins will find themselves in breach of their SLA’s regarding security. To fix the issue the PHP version on the servers will need to be updated.

Below are the steps required to update to PHP7.0.

1
2
# Add the apt-get repo for php7
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
1
2
# Update apt-get
sudo apt-get update
1
2
# Search the repo for all php7 related packages that you may want to install
sudo apt-cache search php7.0
1
2
# Install all of the packages you want
apt-get install -y php7.0 php7.0-common php7.0-cgi php7.0-cli php7.0-fpm php7.0-curl php7.0-gd php7.0-mcrypt php7.0-tidy php7.0-json php7.0-sqlite3 php7.0-mysql php7.0-opcache php7.0-bz2 php7.0-zip

Thats it… all done.

1
2
# A final check
php -v
1
2
# Locate the php.ini file
php -i | grep .ini

Notes: Just remember that PHP updates will be coming thick and fast. I would think PHP7.1 or 7.2 is just around the corner.
If you use Virtualmin (Recommended), the PHP version can be changed per virtual server under the server config tab on the left.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Packages available at the time of writing (sudo apt-cache search php7.0)
php7.0-common - documentation, examples and common module for PHP
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-curl - CURL module for PHP
php7.0-enchant - Enchant module for PHP
php7.0-gd - GD module for PHP
php7.0-gmp - GMP module for PHP
php7.0-imap - IMAP module for PHP
php7.0-interbase - Interbase module for PHP
php7.0-intl - Internationalisation module for PHP
php7.0-ldap - LDAP module for PHP
php7.0-mcrypt - libmcrypt module for PHP
php7.0-readline - readline module for PHP
php7.0-odbc - ODBC 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-xmlrpc - XMLRPC-EPI module for PHP
php7.0-xsl - XSL module for PHP (dummy)
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-json - JSON module for PHP
php7.0-sybase - Sybase module for PHP
php7.0-sqlite3 - SQLite3 module for PHP
php7.0-mysql - MySQL module for PHP
php7.0-opcache - Zend OpCache module for PHP
php7.0-bz2 - bzip2 module for PHP
php7.0-bcmath - Bcmath module for PHP
php7.0-mbstring - MBSTRING module for PHP
php7.0-soap - SOAP module for PHP
php7.0-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.0-zip - Zip module for PHP
php7.0-dba - DBA module for PHP
Share This