安装php与php-fpm
sudo yum -y install php php-fpm
启动php-fpm服务
sudo systemctl start php-fpm
安装mysql扩展
yum search mysql |grep php
找到相应的包 安装
yum install php-mysqlnd.x86_64
php-fpm 启动后没有监听端口9000
netstat -an未发现监听9000端口。查看/var/log/php5-fpm.log一切正常。
随后查看centos/usr/local/php/etc/php-fpm.con (ubuntu:/etc/php5/fpm/pool.d/www.conf,)
发现listen = /var/run/php5-fpm.sock。
默认安装php5-fpm无监听9000端口,nginx无法链接php5-fpm修正
修改nginx下的sites配置
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param APPLICATION_ENV production;
include fastcgi_params;
}
为
location ~ .php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
重启php5-fpm与nginx后,恢复。