繁体   English   中英

PHP-FPM无法在OS X Mojave下的Nginx上运行

[英]PHP-FPM not running on Nginx under OS X Mojave

我从Mac上的Sierra升级到Mojave,升级并安装了php-fpm(php),nginx并编写了新配置。

PHP未解析php代码,我可以在标头上看到它正在运行PHP,甚至日志也显示了它。 但是,当它呈现页面时,它是空白的。 也没有有用的日志。

curl -v localhost.test / info.php *尝试127.0.0.1 ... * TCP_NODELAY set *连接到localhost.test(127.0.0.1)端口80(#0)

GET /info.php HTTP / 1.1主机:localhost.test用户代理:curl / 7.54.0接受: / <HTTP / 1.1 200 OK <服务器:nginx / 1.15.8 <日期:2019年2月11日,星期一07:37 :17 GMT <Content-Type:text / html; charset = UTF-8 <传输编码:分块<连接:keep-alive <X-Powered-By:PHP / 7.3.1 <*与主机localhost.test的连接#0保持不变

[11-Feb-2019 15:21:30] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[11-Feb-2019 15:21:30] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[11-Feb-2019 15:21:30] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[11-Feb-2019 15:21:30] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[11-Feb-2019 15:21:30] NOTICE: fpm is running, pid 22336
[11-Feb-2019 15:21:30] NOTICE: ready to handle connections

并且目前得到以下内容(全部通过Homebrew安装)。

  1. PHP 7.3.1
  2. NGINX 1.15.8

/usr/local/etc/nginx/nginx.conf

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    include servers/*;
}

/usr/local/etc/nginx/servers/localhost.conf

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;
    }
}

为什么它不解析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;
    }

也与nginx有关, 显示空白的PHP页面

如果页面为空白,则很可能是PHP中的错误。 用简单的PHP页面替换输出当前配置的内容:

<?php phpinfo();

如果可行,您知道问题出在您的PHP。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM