安装tp6项目,初始显示“该网页无法正常运作”,没有显示报错内容
版本:PHP版本7.1.7;项目thinkphp6.0.9
问题:访问时报错“该网页无法正常运作
找到问题:PHP配置文件php.ini找到以下两个配置项修改为On,并予重启php
display_errors = Off 修改 display_errors = On
display_startup_errors = Off 修改 display_startup_errors = On
重启PHP:service php-fpm restart
刷新网站报错(当前网站问题报错)

Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/new_tp6/vendor/autoload.php) is not within the allowed path(s): (/home/wwwroot/new_tp6/public/:/tmp/:/proc/) in /home/wwwroot/new_tp6/public/index.php on line 15
Warning: require(/home/wwwroot/new_tp6/vendor/autoload.php): failed to open stream: Operation not permitted in /home/wwwroot/new_tp6/public/index.php on line 15
Fatal error: require(): Failed opening required '/home/wwwroot/new_tp6/public/../vendor/autoload.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/new_tp6/public/index.php on line 15
当前问题:是php open_basedir 配置的问题,PHP不能引入其授权目录上级及其以上的文件;
一般情况下是不会出现这种问题的,之所以出现这个问题绝大多数情况是由于服务器的原因,为了安全才做了这样的限制!
我的解决方案(比较直接):
路径:/usr/local/nginx/conf/fastcgi.conf 注释掉:fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/"; 重启nginx :service nginx restart

浙公网安备 33010602011771号