PHP-FPM未在OS X Mojave下的Nginx上运行
我在Mac上从Sierra升级到Mojave,升级并安装了php fpm(php)、nginx,并在新的配置中编写 PHP没有解析PHP代码,我可以在标题上看到它正在运行PHP,甚至日志也显示了它。但是,当它呈现页面时,它是空白的。也没有有用的日志 curl-v localhost.test/info.php *正在尝试127.0.0.1。。。 *TCP_节点集 *已连接到localhost.test(127.0.0.1)端口80(#0) GET/info.php HTTP/1.1 主机:localhost.test 用户代理:curl/7.54.0 接受:/PHP-FPM未在OS X Mojave下的Nginx上运行,php,nginx,macos-mojave,Php,Nginx,Macos Mojave,我在Mac上从Sierra升级到Mojave,升级并安装了php fpm(php)、nginx,并在新的配置中编写 PHP没有解析PHP代码,我可以在标题上看到它正在运行PHP,甚至日志也显示了它。但是,当它呈现页面时,它是空白的。也没有有用的日志 curl-v localhost.test/info.php *正在尝试127.0.0.1。。。 *TCP_节点集 *已连接到localhost.test(127.0.0.1)端口80(#0) GET/info.php HTTP/1.1 主机:loc
是什么原因导致它没有解析PHP代码?确保~.PHP是正确的
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
同样与相关的是,如果页面为空白,则PHP中很可能存在错误。将PHP页面替换为输出当前配置的简单页面:
<?php phpinfo();
谢谢。我错过了配置中的include参数和其他fastcgi_参数选项。在我修改它并加倍检查后,重新启动。“它现在能工作了!”路易·埃米兰达很高兴它能工作!您应该将其作为问题的答案发布,并将其标记为帮助遇到此问题的任何其他人的答案。您可以检查PHP-FPM是否在此处运行
server {
listen 80;
server_name localhost.test;
access_log /usr/local/var/log/nginx/localhost.test.access.log;
index index.php;
root /Users/louie/Development/php;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
<?php phpinfo();