Nov 9, 2015

Without creating an article to install PHP7, I prefer to share with you this great post: How to Install PHP 7.0, Apache 2.4.17, & MySQL 5.6 on Ubuntu 15.10 & 14.
So, the following information in my article bellow are now deprecated and was only effective to the nightly version of PHP7.
1sudo nano /etc/apt/sources.list 2deb http://archive.ubuntu.com/ubuntu jessie main 3aptitude update
Add Zends PHP7 early access repo:
1echo "deb http://repos.zend.com/zend-server/early-access/php7/repos ubuntu/" >> /etc/apt/sources.list
To install PHP7 nighly build:
1apt-get update && apt-get install php7-nightly
1aptitude install apache2 apache2-mpm-worker libapache2-mod-fastcgi
Then create the file /etc/apache2/conf-available/php7-fpm.conf with the contents:
1<IfModule mod_fastcgi.c> 2 AddHandler php7-fcgi .php 3 Action php7-fcgi /php7-fcgi 4 Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi 5 FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -socket /var/run/php7-fpm.sock -pass-header Authorization 6</IfModule>
Then enable the new mods and config:
1a2enmod actions fastcgi alias 2a2enconf php7-fpm 3a2dismod mpm_event 4a2enmod mpm_prefork 5service apache2 reload
1aptitude install mysql-server mysql-client
To get, build and install PHP7 from sources, you will need some tools to be installed in your linux. Use the next command to install the needed tools:
1aptitude install git make autoconf build-essential libt1-dev libgmp-dev bison re2c libxml2-dev libcurl4-openssl-dev libssl-dev libsslcommon2-dev libbz2-dev libjpeg-dev libfreetype6-dev libmcrypt-dev libmysqlclient-dev libaspell-dev
Create a temporary directory:
1mkdir ~/tmp 2cd ~/tmp
Clone sources from git repository:
1git clone https://git.php.net/repository/php-src.git
You can now build and configure your env
1cd php-src 2./buildconf 3./configure \ 4 --prefix=/usr/local/php7 \ 5 --with-config-file-path=/usr/local/etc/php7 \ 6 --localstatedir=/usr/local/var \ 7
You can now make and install sources
1make 2make test 3sudo make install
We now need to create a symlink:
1sudo ln -sf /usr/local/php7/bin/php /usr/bin/php
add to /etc/apache2/sites-enabled/000-default.conf or other vhost conf file:
1AddType application/x-httpd-php .php .phtml
1cd /usr/local/etc/php7 2sudo nano php.ini
paste the code:
1max_execution_time=600 2memory_limit=128M 3error_reporting=1 4display_errors=1 5log_errors=1 6
1ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
1aptitude install firebird2.5-dev
1aptitude install unixodbc-dev unixodbc-bin unixodbc
1aptitude install libpq-dev