Compiling PHP 5.6.10
Into a Debian 8 machine base.
cd /usr/local/src
wget http://au1.php.net/get/php-5.6.10.tar.gz/from/this/mirror -O php-5.6.10.tar.gz
tar -xzvf php-5.6.10.tar.gz
cd php-5.6.10
Now if you write “./configure” You will see:
configure: error: no acceptable C compiler found in $PATH
First install build essential.
apt-get install -y build-essential
Write again “./configure”. This error:
configure: error: xml2-config not found. Please check your libxml2 installation.
Installing libxml2-dev
apt-get install -y libxml2-dev
Write “./configure” and now you can do “make”.
If you need help about configure options then.
./configure --help
Let’s configure with option PHP-FPM enabled.
./configure --enable-fpm
And now:
make
make install
You can have a cup of tea :-)
Ok. Let’s try it. First install Nginx.
apt-get install -y nginx
When finish if You go to http://here_your_ip/ you will see default Nginx Page.
Execute:
php-fpm
This It’ll be the error:
ERROR: failed to load configuration file '/usr/local/etc/php-fpm.conf'
Copy default file.
cp /usr/local/src/php-5.6.10/sapi/fpm/php-fpm.conf /usr/local/etc/php-fpm.conf
And change ‘nobody’ to ‘www-data’.
user = www-data
group = www-data
Execute again php-fpm.
Now in ‘default’ site in Nginx (/etc/nginx/sites-enabled/default) uncomment PHP zone.
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass 127.0.0.1:9000;
}
Create this file ‘/usr/share/nginx/html/test.php’ with this content:
<?php
phpinfo();
?>
Reload Nginx configuration:
nginx -s reload
Now if you go to http://here_your_ip/test.php