现象:
访问网站页面提示 access denied
查看NGINX错误日志,报如下错误
2018/08/24 11:26:44 [error] 10339#0: *1638 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open_basedir restriction in effect. File(/data/wwwroot/default/**/index.php) is not within the allowed path(s): (/data/wwwroot/home/wwwroot/***.com/:/tmp/:/proc/) in Unknown on line 0
PHP message: PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
解决:
错误日志提到open_basedir,应该是PHP 限制了目录访问限制,我用的是PHP-PFM
打开php.ini ,找到open_basedir,修改如下:
open_basedir =/data/wwwroot:/tmp/
查看php-fpm 的进程ID
cat /usr/local/php/var/run/php-fpm.pid
重启php-fpm
kill -USR2 1731