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条)

报告相同问题?

悬赏问题

  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值