溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

require(): open_basedir restri

發(fā)布時(shí)間:2020-06-01 14:45:49 來源:網(wǎng)絡(luò) 閱讀:1618 作者:falconfei 欄目:web開發(fā)

LNMP環(huán)境安裝Laravel,在nginx.conf將root指向項(xiàng)目的public目錄的時(shí)候(如:root /home/wwwroot/laravel/public),瀏覽器運(yùn)行報(bào)500錯(cuò)誤,錯(cuò)誤信息為:
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 發(fā)現(xiàn)“open_basedir”為注釋狀態(tài)
2、查看nginx下的fastcgi.conf ,發(fā)現(xiàn)“fastcgi_param”參數(shù)如下
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
這里的$document_root 就是 nginx中定義的root的目錄
3、修改nginx下的fastcgi.conf,在后面追加上項(xiàng)目的根目錄,如下:
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/:/home/wwwroot/laravel/";
4、重啟lnmp ,錯(cuò)誤消失。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI