php laravel 宝塔 访问报错 Warning: require(): 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/";
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?