With no PPA’s available at this point in time, not always possible to upgrade to a later model of Ubuntu and with the expected performance increases we have to resort to a more manual approach to get some PHP 7 action sooner rather and later.

You can check your Ubuntu version with
# lsb_release -a

Distributor ID: Ubuntu
Description: Ubuntu 12.04 LTS
Release: 12.04
Codename: precise

Head over to to http://php.net and grab a link to a close mirror

Log into your server and download the appropriate version wth something like wget or curl
# wget -O php-7.0.0.tar.gz http://au2.php.net/get/php-7.0.0.tar.gz/from/this/mirror

Extract the archive
# tar zxvf php-7.0.0.tar.gz

Change directory to the extracted PHP 7 source code
# cd php-7.0.0

Install some required packages (these are what I needed, the configure process will tell you if there is an error and a search of you best friend / Google will give you pointers of what other packages you need to install. The reference pages I’ve included at the bottom of this post will probably be of help too)
# sudo apt-get -y install build-essential git autoconf libxml2-dev libcurl4-openssl-dev libcurl4-openssl-dev libbz2-dev libjpeg-dev libpng-dev libxpm-dev libfreetype6-dev libgmp-dev libfreetype6-dev libgmp-dev libmcrypt-dev libmysqlclient15-dev libmysqlclient15-dev libpspell-dev librecode-dev

Run BuildConf
# ./buildconf

Run Configure (the options I’ve used here come from various reference and what I have installed in my current running version of PHP)
 # ./configure --prefix=/usr --with-config-file-path=/etc --enable-mbstring --enable-zip --enable-bcmath --enable-pcntl --enable-ftp --enable-exif --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-curl --with-mcrypt --with-iconv --with-gmp --with-pspell --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr --enable-gd-native-ttf --enable-gd-jis-conv --with-openssl --with-pdo-mysql=/usr --with-gettext=/usr --with-zlib=/usr --with-bz2=/usr --with-recode=/usr --with-mysqli=/usr/bin/mysql_config

Build PHP
# make

Test the build
# make test

Install the build
# sudo make install

References:
1. http://jcutrer.com/howto/linux/how-to-compile-php7-on-ubuntu-14-04
2. http://stackoverflow.com/questions/30987883/how-do-i-install-php-7-php-next-generation-on-ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>