PHP腳本中include文件出錯(cuò)解決方法
更新時(shí)間:2008年11月20日 14:01:59 作者:
經(jīng)常當(dāng)php頁(yè)面中利用include, require, require_once包含了一些其他位置的頁(yè)面時(shí),會(huì)出現(xiàn)錯(cuò)誤,比如沒有發(fā)現(xiàn)次頁(yè)面,或者權(quán)限不允許等,可以根據(jù)以下方法來(lái)排除
1. 出現(xiàn)“未找到文件“類似的錯(cuò)誤時(shí)候,檢查include文件的位置是否正確,下面引用php手冊(cè)頁(yè)面的原話:
Files for including are first looked in include_path relative to the current working directory and then in the directory of the current script. E.g. if your include_path is libraries, current working directory is /www/, you included include/a.php and there is include "b.php" in that file, b.php is first looked in /www/libraries/ and then in /www/include/. If filename begins with ./ or ../, it is looked only in include_path relative to the current working directory.
2. 當(dāng)出現(xiàn)permission deny 類似錯(cuò)誤的時(shí)候,按以下方法排除
a) 檢測(cè)被包含的文件讀權(quán)限是否打開
b) 檢測(cè)被包含的文件路徑上的每個(gè)目錄的x權(quán)限是否打開,該權(quán)限決定了目錄能否被瀏覽。
Files for including are first looked in include_path relative to the current working directory and then in the directory of the current script. E.g. if your include_path is libraries, current working directory is /www/, you included include/a.php and there is include "b.php" in that file, b.php is first looked in /www/libraries/ and then in /www/include/. If filename begins with ./ or ../, it is looked only in include_path relative to the current working directory.
2. 當(dāng)出現(xiàn)permission deny 類似錯(cuò)誤的時(shí)候,按以下方法排除
a) 檢測(cè)被包含的文件讀權(quán)限是否打開
b) 檢測(cè)被包含的文件路徑上的每個(gè)目錄的x權(quán)限是否打開,該權(quán)限決定了目錄能否被瀏覽。
相關(guān)文章
PHP操作Redis數(shù)據(jù)庫(kù)常用方法示例
這篇文章主要介紹了PHP操作Redis數(shù)據(jù)庫(kù)常用方法,結(jié)合實(shí)例形式總結(jié)分析了php針對(duì)redis數(shù)據(jù)庫(kù)連接、字符串、列表、hash字典、set集合等數(shù)據(jù)類型相關(guān)操作技巧,需要的朋友可以參考下2018-08-08php 操作數(shù)組(合并,拆分,追加,查找,刪除等)
這篇文章主要介紹了php自帶的一些操作數(shù)組的函數(shù),特整理下方便大家使用2012-07-07yii框架中的Url生產(chǎn)問(wèn)題小結(jié)
yii框架中的Url生產(chǎn)問(wèn)題小結(jié),需要的朋友可以參考下。2012-01-01剛才在簡(jiǎn)化php的庫(kù),結(jié)果發(fā)現(xiàn)很多東西
剛才在簡(jiǎn)化php的庫(kù),結(jié)果發(fā)現(xiàn)很多東西...2006-12-12PHP的數(shù)組中提高元素查找與元素去重的效率的技巧解析
這篇文章主要介紹了PHP的數(shù)組中提高元素查找與元素去重的效率的技巧解析,文中對(duì)比了相關(guān)方法的執(zhí)行速度來(lái)總結(jié)數(shù)組中使元素查找和去重更加高效的辦法,需要的朋友可以參考下2016-03-03