Home > Article > Operation and Maintenance > How to install php-fpm on centos7
How to install "php-fpm" in centos7: first install "php-fpm" related components through yum; then modify the content in "default.conf" to support php; finally restart the nginx service.
Recommended: "centos Getting Started Tutorial"
##CentOS7 uses yum to install Nginx php-fpm
Environment[root@localhost html]# cat /etc/centos-release CentOS Linux release 7.1.1503 (Core) [root@localhost sbin]# /usr/sbin/nginx -v nginx version: nginx/1.14.0 [root@localhost /]# php-fpm -v PHP 5.4.16 (fpm-fcgi) (built: Apr 12 2018 19:03:25) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies1. Install nginx
rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm yum install -y nginx systemctl start nginx systemctl status nginx systemctl stop nginx systemctl enable nginxOpen the following address with a browser to access it It means the configuration is successful
http://192.168.0.61/2.yum installs php-fpm related components
yum -y install php php-fpm php-gd php-mysql php-common php-pear php-mbstring php-mcrypt systemctl status php-fpm systemctl start php-fpm systemctl enable php-fpm3. Edit /etc/nginx/conf.d/default.conf and add the following content to support php vim /etc/nginx/conf.d/default.conf
# location ~ \.php$ { root /usr/share/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }After modifying the configuration, you need to restart the nginx service4. Create the index.php file and testvim /usr/share/nginx/html/index.php
<?php phpinfo(); ?>Open: http://192.168.0.61
The above is the detailed content of How to install php-fpm on centos7. For more information, please follow other related articles on the PHP Chinese website!