环境配置:centos 7 ; php 7.1.5
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
解决方法:
如果你是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/
按上面的这个例子修改,换成你自己的域名和目录,多个网站就按上面的例子改成多个,最后重启php-fpm:/etc/init.d/php-fpm restart
上面路径地址 不需要到 public 里面