您好,登錄后才能下訂單哦!
LNMP環境安裝Laravel,在nginx.conf將root指向項目的public目錄的時候(如:root /home/wwwroot/laravel/public),瀏覽器運行報500錯誤,錯誤信息為:
Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/laravel/vendor/autoload.php) is not within the allowed path(s): (/home/wwwroot/laravel/public/:/tmp/:/proc/:/home/wwwroot/laravel/public/) in /home/wwwroot/laravel/public/index.php on line 24
Warning: require(/home/wwwroot/laravel/vendor/autoload.php): failed to open stream: Operation not permitted in /home/wwwroot/laravel/public/index.php on line 24
Fatal error: require(): Failed opening required '/home/wwwroot/laravel/public/../vendor/autoload.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/laravel/public/index.php on line 24
1、查找php.ini 發現“open_basedir”為注釋狀態
2、查看nginx下的fastcgi.conf ,發現“fastcgi_param”參數如下
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
這里的$document_root 就是 nginx中定義的root的目錄
3、修改nginx下的fastcgi.conf,在后面追加上項目的根目錄,如下:
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/:/home/wwwroot/laravel/";
4、重啟lnmp ,錯誤消失。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。