failed to open stream: No such file or directory 問題大全,本文由幫客之家小編收集整理,請在轉載時保留出處。
案例一:
(failed to open stream: No such file or directory)在IIS下PHP環境配置的目錄權限導致出錯的問題
原因及解決方法:
配置環境為 IIS + php
如果確認你的程序在其他環境下下可以正常運行而唯獨在Win 下的 IIS 出現類似如下的錯誤:
Warning: main(./Config.php): failed to open stream: No such file or directory in D:\wwwroot\Demo\Config.php on line 13
Fatal error: main(): Failed opening required './Config.php' (include_path='.;c:\php4\pear') in D:\wwwroot\Core\Config.php on line 13
這個問題主要是 由於Win NTFS盤下去除了everyone 權限引起的, 在安全權限中加個 Internet 來賓賬號就解決了.
操作步驟: D盤 -> 屬性 -> 安全 -> 添加 用戶 IUSR_XXXXX OK
案例二:
問題就是:
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實例:
Copy to Clipboard引用的內容:[www.bkjia.com] <?php案例三:
運行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
文件結構: