LNMP环境运行laravel open_basedir restriction in effect 问题
安裝 lnmp 后 發現怎么都運行不了 laravel 一直顯示500 狀態碼,都給了 stoage 目錄權限了 。于是開啟 php 錯誤。
Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/default/1211/bootstrap/autoload.php) is not within the allowed path(s): (/home/wwwroot/default/1211/public/:/tmp/:/proc/) in /home/wwwroot/default/1211/public/index.php on line 22
Warning: require(/home/wwwroot/default/1211/bootstrap/autoload.php): failed to open stream: Operation not permitted in /home/wwwroot/default/1211/public/index.php on line 22
Fatal error: require(): Failed opening required '/home/wwwroot/default/1211/public/../bootstrap/autoload.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/default/1211/public/index.php on line 22
錯誤日志顯示,訪問腳本不在 open_basedir的限定目錄里面,配置open_basedir 一般會在php.ini 或 nginx 配置文件里面
首先檢測php.ini 我發現并沒有配置 open_basedir
然后檢測nginx配置,去到 nginx 根目錄,運行
grep -rn open_basedir ./ 復制代碼發現 fastcgi.conf 中配置了open_basedir $document_root指向的是網站跟目錄。 我改成了下面內容
#fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/"; 復制代碼重啟 nginx 服務
service nginx reload 復制代碼轉載于:https://juejin.im/post/5a333e6a51882520ea3a3956
總結
以上是生活随笔為你收集整理的LNMP环境运行laravel open_basedir restriction in effect 问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 文献管理工具mendeley登录问题
- 下一篇: 雨中游记 二