laravel 线上报错Warning: require(): open_basedir restriction in effect. File(/www/wwwroot/ytsjk/bootstra

laravel 线上 

Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/default/laravel/bootstrap/autoload.php) is not within the allowed path(s): (/home/wwwroot/default/laravel/public/:/tmp/:/proc/) in /home/wwwroot/default/laravel/public/index.php on line 22

Warning: require(/home/wwwroot/default/laravel/bootstrap/autoload.php): failed to open stream: Operation not permitted in /home/wwwroot/default/laravel/public/index.php on line 22

Fatal error: require(): Failed opening required '/home/wwwroot/default/laravel/public/../bootstrap/autoload.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/default/laravel/public/index.php on line 22

 

用的宝塔面板(测试过,可用):

关闭防跨站攻击(open_basedir)

laravel 线上报错Warning: require(): open_basedir restriction in effect. File(/www/wwwroot/ytsjk/bootstra_第1张图片

取消打钩,重新保存,并重启php

 

其他方法(不知是否可行):

1.删除user.ini

2.在nginx的fastcgi.conf配置文件中

删除或注释掉这一行fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";

3.也有资料说将fastcgi_param PHP_ADMIN_VALUE"open_basedir=$document_root/:/tmp/:/proc/";改成:fastcgi_param PHP_ADMIN_VALUE "open_basedir=NULL";  然后重启一下服务

4.如果你是PHP 5.3.3以上的版本,可以修改/usr/local/php/etc/php.ini在末尾里加入:

[HOST=www.project.com]
open_basedir=/home/wwwroot/default/laravel/:/tmp/
[PATH=/home/wwwroot/default/laravel/public]
open_basedir=/home/wwwroot/default/laravel/:/tmp/

参考:

https://blog.csdn.net/qq_42249896/article/details/87108146

https://blog.csdn.net/Cpath/article/details/78546053

https://www.cnblogs.com/zouzhe0/p/7149823.html

https://blog.csdn.net/watermelonmk/article/details/80967658

你可能感兴趣的:(laravel)