博客 > 【Plesk經(jīng)驗(yàn)分享】Plesk中托管的網(wǎng)站不可訪問怎么辦?
瀏覽量:7379次評(píng)論:0次
作者:Christina時(shí)間:2019-09-06 06:43:58
適用版本:
Plesk for Windows
問題
網(wǎng)站不可訪問,且出現(xiàn)下面的錯(cuò)誤:
404 file not found
或
500 Internal Server Error
或
Error 500 move_uploaded_file(): open_basedir restriction in effect. File(/var/www/any/path/to/the/directory) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/)
在Plesk for Linux中,域名錯(cuò)誤日志文件 /var/www/vhosts/example.com/logs/error_log中出現(xiàn)下面的錯(cuò)誤信息:
A PHP Error was encountered
Severity: Warning
Message: is_dir(): open_basedir restriction in effect. File(/var/lib/php/session) is not within the allowed path(s): (/home/www/vhosts/example.com/:/tmp/)
或
Got error 'age: PHP Warning is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/httpdocs/wp-includes/functions.php on line 1613\
在Plesk for Windows中,域名錯(cuò)誤日志文件 %plesk_vhosts%example.com\logs\php_errors\example.com\php_error.log 中出現(xiàn)下面的錯(cuò)誤信息:
PHP Warning: Unknown: open_basedir restriction in effect. File(E:\custom_folder\sessions) is not within the allowed path(s): (C:/inetpub/vhosts/example.com\;C:\Windows\Temp\) in Unknown on line 0
在某些情況下:
在 域名 > example.com > PHP 設(shè)置 > 查看 phpinfo() 頁(yè)面 啟動(dòng)的php.ini頁(yè)面不可訪問:
Unable to retrieve information about the PHP configuration
日志文件大小增加得非常快:
# find /var/www/vhosts/system -size +1G -exec ls -lh {} \;
-rw-r--r-- 2 root root 218G 1. Jun 11:27 /var/www/vhosts/system/example.com/logs/error_log
原因
PHP腳本正嘗試訪問不允許訪問的文件夾。該限制由單獨(dú)針對(duì)每個(gè)虛擬主機(jī)的PHP open_basedir 變量控制。默認(rèn)open_basedir 會(huì)被設(shè)置為允許PHP文件訪問 tmp 和 httpdocs 目錄。
解決方案
調(diào)整open_basedir的值以包括取自錯(cuò)誤信息的丟失的路徑:
1. 在Plesk中轉(zhuǎn)入 域名 > example.com > PHP 設(shè)置。
2. 修改open_basedir的值:
? Linux:
以下示范將目錄 /var/lib/php/session 包括到 open_basedir中:
{WEBSPACEROOT}{/}{:}{TMP}{/}{:}{/}var{/}lib{/}php{/}session{/}
或
/var/www/vhosts/example.com/:/tmp/:/var/lib/php/session
? Windows:
以下示范將目錄 E:\custom_folder\sessions 包括到 open_basedir 中:
{WEBSPACEROOT}{/};{TMP};{/};"E:\custom_folder\sessions\
3. 應(yīng)用更改。
"相關(guān)文章推薦
2025-06-03 16:11:30
2025-05-29 16:58:20
2025-05-28 15:34:20
2025-05-27 17:20:38
2025-05-27 11:53:22
熱門工具
標(biāo)簽選擇
閱讀排行
我的評(píng)論
還未登錄?點(diǎn)擊登錄