php-fpm.d/www.conf
listen = /tmp/php-cgi-70.sock
listen.backlog = -1
listen.mode = 0666
php_admin_value[error_log] = /usr/local/var/log/php-fpm/php-fpm70.log #错误日志(选配)
在nginx配置文件目录创建两个文件并保存
#文件名
php-74.conf
#内容
location ~ [^/]\.php(/|$)
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi-70.sock;
fastcgi_index index.php;
include fastcgi.conf;
include pathinfo.conf;
}
#文件名
pathinfo.conf
#内容
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
新建以上两个文件之后,直接在 nginx.conf 中 include php-74.conf; 就可以用了
php.ini 不用改,如果开了以下选下注释掉即可
open_basedir 选项可以注释掉
评论区