failed to open stream: No such file or directory 問題大全,本文由烈火網小編收集整理,請在轉載時保留出處。php
案例一:apache
(failed to open stream: No such file or directory)在IIS下PHP環境配置的目錄權限致使出錯的問題安全
緣由及解決方法:網站
配置環境爲 IIS + phpui
若是確認你的程序在其餘環境下下能夠正常運行而惟獨在Win 下的 IIS 出現相似以下的錯誤:spa
Warning: main(./Config.php): failed to open stream: No such file or directory in D:\wwwroot\Demo\Config.php on line 13code
Fatal error: main(): Failed opening required './Config.php' (include_path='.;c:\php4\pear') in D:\wwwroot\Core\Config.php on line 13blog
這個問題主要是 因爲Win NTFS盤下去除了everyone 權限引發的, 在安全權限中加個 Internet 來賓帳號就解決了.ip
操做步驟: D盤 -> 屬性 -> 安全 -> 添加 用戶 IUSR_XXXXX OKit
案例二:
問題就是:
Warning: require_once(../lib/DBUtil.class.php) [function.require-once]: failed to open stream: No such file or directory in E:\phppro\dxh\service\ExpertService.class.php on line 2
Fatal error: require_once() [function.require]: Failed opening required '../lib/DBUtil.class.php' (include_path='.;C:\php5\pear') in E:\phppro\dxh\service\ExpertService.class.php on line 2
解決方法:
1.在require時加上dirname(__FILE__),像這樣: require_once(dirname(__FILE__)."/../lib/DBUtil.class.php");
2.以下理解 require_once實例:
案例三:
運行php網站,出錯,內容以下:
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'E:/php/www/mrsoft/註冊登陸模塊/index.php' (include_path='.;C:\php5\pear') in Unknown on line 0
文件結構:
解決方法:
apache不能解析上圖中「註冊登陸模塊」的中文URL,把它換成英文路徑便可。