宝塔部署时,出现“open_basedir restriction in effect”错误

下面是错误代码:

Warning: require(): open_basedir restriction in effect. File(/www/webdisk/www.wenfeikeji.com/vendor/autoload.php) is not within the allowed path(s): (/www/webdisk/www.wenfeikeji.com/public/:/tmp/) in /www/webdisk/www.wenfeikeji.com/public/index.php on line 15
Warning: require(/www/webdisk/www.wenfeikeji.com/vendor/autoload.php): failed to open stream: Operation not permitted in /www/webdisk/www.wenfeikeji.com/public/index.php on line 15
Fatal error: require(): Failed opening required '/www/webdisk/www.wenfeikeji.com/public/../vendor/autoload.php' (include_path='.:') in /www/webdisk/www.wenfeikeji.com/public/index.php on line 15

以下有两种解决方案:

方案1:去掉网站目录下的勾选,防跨站攻击(open_basedir),然后重启php服务。

微信截图_20211219164619.png

方案2:修改目录下的.user.ini的隐藏文件,去掉public目录地址

微信截图_20211219164909.png