Nginx配置open_basedir详解:open_basedir restriction in effect.报错

错误信息

Warning: require(): open_basedir restriction in effect. File(/www/wwwroot/nxcrm/vendor/autoload.php) is not within the allowed path(s): (/www/wwwroot/nxcrm/public/:/tmp/) in /www/wwwroot/nxcrm/public/index.php on line 24

Warning: require(/www/wwwroot/nxcrm/vendor/autoload.php): Failed to open stream: Operation not permitted in /www/wwwroot/nxcrm/public/index.php on line 24

Fatal error: Uncaught Error: Failed opening required '/www/wwwroot/nxcrm/public/../vendor/autoload.php' (include_path='.:') in /www/wwwroot/nxcrm/public/index.php:24 Stack trace: #0 {main} thrown in /www/wwwroot/nxcrm/public/index.php on line 24

解决方法

1、在宝塔设置网站目录中,不要勾选防跨站攻击,问题解决。

2、进入/www/server/nginx/conf目录下,找到fastcgi.conf,修改其中的一个参数’fastcgi_param PHP_ADMIN_VALUE’,没有的话可以自己加一个,/www/wwwroot是你的项目路径,每个人可能都不一样

fastcgi_param PHP_ADMIN_VALUE "open_basedir=/www/wwwroot/:/tmp/:/proc/"; 多个路径用:冒号隔开,文件夹以/结尾。
Nginx配置open_basedir详解:open_basedir restriction in effect.报错

发表回复

Scroll to top