Compile and install PHP 7.0.13 in Centos 6.5, centos7.0.13
The official PHP7.0 version is also available. I have compiled and installed it today and wrote down the installation steps. I compiled it in the centos6.6 environment. The installation steps are as follows:
Environment dependency
yum install gcc gcc-c++ libxml2 libxml2-python libxml2-devel -y
Download
wget http://cn2.php.net/distributions/php-7.0.13.tar.gz
Extract
tar -zxvf php-7.0.13.tar.gzcd php-7.0.13./configure --enable-fpm --with-mysqlmakemake install
Create a configuration file and copy it to the correct location.
cp php.ini-development /usr/local/php/php.inicp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.confcp sapi/fpm/php-fpm /usr/local/bin
Note that, if the file does not exist, Nginx is prevented from sending requests to the backend PHP-FPM module to avoid malicious script injection attacks.
Set the configuration items in the php. ini filecgi.fix_pathinfo
Set to 0.
vim /usr/local/php/php.ini
Gocgi.fix_pathinfo=
And modify it as follows:
cgi.fix_pathinfo=0
Before starting the service, you need to modify the php-fpm.conf configuration file to ensure that the php-fpm module runs as the hz user and hz user group.
Copy fpm
cp /usr/local/etc/php-fpm.d/www.conf.default php-fpm.conf
Modify the fpm Module
vim /usr/local/etc/php-fpm.d/php-fpm.conf
Modify default port
listen = 127.0.0.1:9001; Unix user/group of processes; Note: The user is mandatory. If the group is not set, the default user's group; will be used.user = hzgroup = hz
Start the php-fpm service:
./usr/local/bin/php-fpm
Fpm Detection
./usr/local/bin/php-fpm -t [01-Dec-2016 18:11:43] NOTICE: configuration file /usr/local/etc/php-fpm.conf test is successful
Default php Directory
find / -name php/php-7.0.13/sapi/cli/php/usr/local/include/php/usr/local/bin/php/usr/local/php/usr/local/php/php/usr/local/lib/php
Test page
Create phpinfo for work
echo '<?php phpinfo(); ?>' > /var/www/html/info.php
Create test page
curl http://localhost/info.php | grep 'PHP Version' | tail -1 | sed -e 's/<[^>]*>//g'
Webpage Testing
Http: // 192.168.31.66/info. php
Summary
The above is all about compiling and installing PHP 7.0.13 in Centos 6.5. I hope the content in this article will help you in your study or work, if you have any questions, you can leave a message.