1, and execute the following commands to install PHP and some of the required extension
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php70w-tidy php70w-common php70w-devel php70w-pdo php70w-mysql php70w-gd php70w-ldap php70w-mbstring php70w-mcrypt php70w-fpm
2, input php -v
validation installed version of PHP
3, systemctl start php-fpm
start php service
4, systemctl enable php-fpm
set to boot
5, modify configuration files nginx
Added index.php in the index was
let Nginx support php format Home
location /
{
root /usr/local/webserver/nginx/html;
index index.html index.htm index.php;
}
Note : /usr/share/nginx/html
part of the rest of Nginx own path without change
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
Save and exit
6, service nginx reload
reload the configuration file
7, test
Enter vi info.php
to create a test page called info.php in html package
Input:
<?php
phpinfo();
?>
Storage
Then enter in the browserhttp://服务器ip地址/info.php
If the following figure shows the PHP environment to build success: