企業(yè)網(wǎng)站 手機網(wǎng)站 app 微網(wǎng)站廣州網(wǎng)站建設系統(tǒng)
項目場景:
在CentOS8中安裝了寶塔,配置thinkphp5.1版本環(huán)境時出了問題,在此之前網(wǎng)站虛擬域名成功配置,能夠訪問站點創(chuàng)建成功的頁面
問題描述:
在訪問tp5默認頁面時報錯
Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/xxxxxx/thinkphp/start.php) is not within the allowed path(s): (/home/wwwroot/xxxxxx/public/:/tmp/:/proc/) in /home/wwwroot/xxxxxx/public/index.php on line 16Warning: require(/home/wwwroot/xxxxxx/thinkphp/start.php): failed to open stream: Operation not permitted in /home/wwwroot/xxxxxx/public/index.php on line 16Fatal error: require(): Failed opening required ‘/www/wwwroot/xxxxxx/public/../thinkphp/start.php’ (include_path=’.:/usr/local/php/lib/php’) in /home/wwwroot/xxxxxx/public/index.php on line 16
原因分析:
起初看英文提示,以為是文件缺少,隨后找了一下,發(fā)現(xiàn)文件都是在的。然后第二段警告提示了權限不足,又去修改權限,還是不行。后來發(fā)現(xiàn)是open_basedir的問題,那么有兩個方法來解決這個問題。
解決方案:
1、在設置網(wǎng)站目錄中,不要勾選防跨站攻擊,問題解決。
2、進入/www/server/nginx/conf目錄下,找到fastcgi.conf,修改其中的一個參數(shù)’fastcgi_param PHP_ADMIN_VALUE’,沒有的話可以自己加一個,/www/wwwroot是你的項目路徑,每個人可能都不一樣
fastcgi_param PHP_ADMIN_VALUE "open_basedir=/www/wwwroot/:/tmp/:/proc/";
兩種方法任選其一即可
發(fā)布者:全棧程序員棧長,轉(zhuǎn)載請注明出處:https://javaforall.cn/172110.html原文鏈接:https://javaforall.cn
Fatal error: require(): Failed opening required ‘/www/wwwroot/xxxxxx/public/../thinkphp/start.php-騰訊云開發(fā)者社區(qū)-騰訊云 (tencent.com)