nginx +php-fpm配置服务器错误

nginx +php-fpm

  • lnmp1.5 安装
  • 使用lnmp vhost add添加虚拟域名

问题描述:提示500错误;

打开/usr/local/php/etc/php.ini,

display_errors = Off
改为为:
display_errors = On

重启服务器页面错误提示:

Warning: require(): open_basedir restriction in effect. File(/xxx/xxx/thinkphp/base.php) is not within the allowed path(s): (/xxx/xxx/public/:/tmp/:/proc/) in /xxx/xxx/public/index.php on line 16

Warning: require(/xxx/xxx/thinkphp/base.php): failed to open stream: Operation not permitted in /xxx/xxx//public/index.php on line 16

Fatal error: require(): Failed opening required '/xxx/xxx/public/../thinkphp/base.php' (include_path='.:/usr/local/php/lib/php') in /xxx/xxx/public/index.php on line 16

问题排查:
1.项目目录.user.ini文件

open_basedir=/project/dev/tp5-auth:/tmp/:/proc/

配置是正确,此处的tp5-auth后无public是正确的。。
2.打开 /usr/local/nginx/conf/fastcgi.conf 文件

fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
修改为:
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/../:/tmp/:/proc/";

3.上面的1,2解决不了,采用第三种方法

#fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/../:/tmp/:/proc/";
fastcgi_param PHP_ADMIN_VALUE "open_basedir=null";

问题解决!!!!

你可能感兴趣的:(【PHP技术文档】)