Linux environment to build and install PHP 7

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 -vvalidation installed version of PHP

Here Insert Picture Description

3, systemctl start php-fpmstart php service

4, systemctl enable php-fpmset 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/htmlpart 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 reloadreload the configuration file

7, test

Enter vi info.phpto 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:
Here Insert Picture Description


Published 174 original articles · won praise 5 · Views 240,000 +

Guess you like

Origin blog.csdn.net/Piconjo/article/details/104987567