drnxnbf199049 2019-02-11 07:40 采纳率: 100%
浏览 89
已采纳

PHP-FPM没有在OS X Mojave下的Nginx上运行

I upgraded from Sierra on my Mac to Mojave and when upgraded and installed the php-fpm (php), nginx and wrote in a new config.

The PHP is not parsing the php code, I can see on the header that it's running PHP and even the logs shows it. But, when it renders the page, it's blank. No useful log as well.

curl -v localhost.test/info.php * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost.test (127.0.0.1) port 80 (#0)

GET /info.php HTTP/1.1 Host: localhost.test User-Agent: curl/7.54.0 Accept: / < HTTP/1.1 200 OK < Server: nginx/1.15.8 < Date: Mon, 11 Feb 2019 07:37:17 GMT < Content-Type: text/html; charset=UTF-8 < Transfer-Encoding: chunked < Connection: keep-alive < X-Powered-By: PHP/7.3.1 < * Connection #0 to host localhost.test left intact

[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

And currently got the following (all installed via 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;
    }
}

What could be the cause why this it's not parsing the PHP code?

  • 写回答

2条回答 默认 最新

  • douji6667 2019-02-11 07:47
    关注

    Make sure the ~.php is correct.

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

    Also related to nginx showing blank PHP pages

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效