首页 > 编程开发 > PHP    日期:2020-09-29 / 来自互联网 / 浏览

今天调试lnmp环境,出现如下报错。无法查询到php信息。

php phpinfo无法访问怎么办?

环境:linux版本CentOS Linux release 7.3.1611 (Core),nginx使用tengine。php和tengine均为源码安装到/usr/local。

首先确认tengine已经启动,在网站根目录下写了个静态测试网页,测试没问题,可以正常显示。

确认php-fpm已经启动,查询服务端口正常。怀疑tengine的php支持没有配置。打开/usr/local/tengine/conf/vhost下面的*.conf主机配置,修改以下配置:追加index.php让nginx服务器默认支持index.php为首页,同时通过注释,启用相关配置。

注意$document_root的位置,可以写成$document_root,也可以写成网站根目录,但是一定不能是默认的/scripts。

location / {
      root  /var/www/html;
      index index.html index.htm index.php;
    }
...
...
location ~ \.php$ {
      root      /var/www/html;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include    fastcgi_params;
    }
...
...

同时,确保/usr/local/php/etc/php-fpm.conf的配置:

listen = 127.0.0.1:9000

然后,重启服务就可以了。

php phpinfo无法访问怎么办?

觉得上面的内容有用吗?快来点个赞吧!

点赞() 我要打赏

温馨提示 : 本站内容来自会员投稿以及互联网,所有源码及教程均为作者总结编辑,请大家在使用过程中提前做好备份,以免发生无法预知的错误,源码类教程请勿直接用于生产环境!

 可能感兴趣的文章