做測(cè)試的時(shí)候 發(fā)現(xiàn)一個(gè)問題。新增加的文章點(diǎn)刪除的時(shí)候會(huì)出現(xiàn) Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(../license.php) is not within the allowed path(s): (D:/mywebserver/DedeAMPZ/WebRoot/Default) in D:\mywebserver\DedeAMPZ\WebRoot\Default\includes\func\common.inc.php on line 801
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(../../license.php) is not within the allowed path(s): (D:/mywebserver/DedeAMPZ/WebRoot/Default) in D:\mywebserver\DedeAMPZ\WebRoot\Default\includes\func\common.inc.php on line 806
以上錯(cuò)誤。 本座初期懷疑是程序本身的問題,資料翻來覆去的看都是沒有解決。都感覺自己腦袋混沌了??癯闊?,抽了一頓之后。便便了一下。一下就輕松了!~~突然腦袋就清醒了。覺得應(yīng)該是出現(xiàn)在環(huán)境問題上。檢查了一下阿帕奇和PHP.INI的配置信息。原來真的是環(huán)境的問題 ! 最近剛剛收了個(gè)徒弟,順便幫他解決類似問題。下面把同樣的問題也列出來
問題2:
Warning: Unknown: open_basedir restriction in effect. File(D:/99Game/WEB/htdocs/index.php) is not within the allowed path(s): (D:Game\WEB\htdocs\;C:\WINDOWS\Temp;) in Unknown on line 0
Fatal error: Can't load D:/99Game/WEB/htdocs/index.php, open_basedir restriction. in Unknown on line 0
問題3:
Warning: imagegif() [function.imagegif]: open_basedir restriction in effect. File(C:\WINDOWS\TEMP\) is not within the allowed path(s): (C:\PHPnow\htdocs;C:\PHPnow\Temp) in C:\PHPnow\htdocs\hdzs\verify_code.php on line 11
Warning: imagegif() [function.imagegif]: Unable to open temporary file in C:\PHPnow\htdocs\hdzs\verify_code.php on line 11
問題4:
虛擬主機(jī),運(yùn)行一個(gè)程序時(shí)出現(xiàn)以下錯(cuò)誤提示:
Warning: file_exists(): open_basedir restriction in effect. File(/home/mainwebsite_html/cache/also_purchased-english.cache11548) is not within the allowed path(s): (/var/web/w0895/:/tmp:/usr/lib/php) in /var/web/w0895/html/includes/functions/cache.php on line 47
問題是出現(xiàn)在了PHP.INI上面了
原因是php.ini里設(shè)置了
opendir=/var/web/w0895/:/tmp:/usr/lib/php
解答:
其實(shí)open_basedir 這個(gè)是用來限制php的目錄訪問權(quán)限什么的,如果不在允許的范圍內(nèi),php就不能訪問。
這個(gè) open_basedir 在 php.ini 里可以設(shè)定,也可以在 apache的httpd.conf 里面設(shè)定
例如:
php_admin_value open_basedir "E:/APMServ5.2.6/www/wordpress/;E:/APMServ5.2.6/tmp/uploadtemp/;"
再比如:
php_admin_value open_basedir =/var/web/w0895/:/tmp:/usr/lib/php
上面問題中的描述,看字面意思好像是open_basedir受到了限制 D:Game\WEB\htdocs\;C:\WINDOWS\Temp; 不屬于允許路徑,php我沒接觸過是不是有個(gè)open_basedir的配置文件?是負(fù)責(zé)目錄權(quán)限的?
php程序里的目錄是D:/99Game/WEB/htdocs/index.php,但出錯(cuò)的目錄是D:Game\WEB\htdocs\
你把D:Game\改成D:\99Game看看