First, install ready
Use the following command yum warehouse pack upgrade the rpm package to replace the PHP7
rpm -Uvh https: // dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https: // mirror.webtatic.com/yum/el7/webtatic-release.rpm
Second, start the installation
1. First, use the command yum install basic PHP components after use to install Han Han
yum -y install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64
2. install PHP-fpm (process management, process management provides PHP, and can effectively control memory processes, smoothing reload configuration PHP)
yum -y install php70w-fpm php70w-opcache
3. Start After installing php-fpm
systemctl start php-fpm
4. Check version to detect whether the installation is successful
php -v
Third, to detect whether PHP can communicate with Nginx
1. Nginx default HTML folder (/ usr / local / webserver / nginx / html /) to create a new index.php, which reads as follows:
<?php phpinfo(); ?>
2. Modify the Nginx configuration file (using find / | grep nginx.conf search profile position) Nginx.conf, modify added as follows:
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
To modify the properties of the original blue font parts, or access index.php, the following occurs (php-fpm php can not find the file in the original SCRIPT_FILENAME executed)
3. Restart Nginx
/usr/local/webserver/nginx/sbin/nginx -s reload
4. Access domain name (IP) /index.php the following content is the successful configuration
Fourth, to detect whether PHP can communicate with mysql
The content on an amended as follows index.PHP
? < PHP // create connection $ the Test = mysqli_connect ( 'localhost', 'root', 'qq1234'); // database server address, account name, password // detect IF (! $ The Test ) echo "Connection failed, please check the mysql service and account password " ; echo " database connection success! " ; ?>
After modifying direct access index.php, without having to restart Nginx