failed to open stream: No such file or directory. This article is collected and organized by the editor of Bangkejia. Please keep the source when reprinting.
Case 1:
(failed to open stream: No such file or directory) The directory permissions configured in the PHP environment under IIS cause errors
Causes and solutions:
Configure the environment as IIS + php
If you confirm that your program can run normally in other environments but an error similar to the following occurs only in IIS under Win:
Warning: main(./Config.php): failed to open stream: No such file or directory in D:wwwrootDemoConfig.php on line 13
Fatal error: main(): Failed opening required './Config.php' (include_path='.;c:php4pear') in D:wwwrootCoreConfig.php on line 13
This problem is mainly caused by the removal of everyone permissions on the Win NTFS disk. It can be solved by adding an Internet guest account to the security permissions.
Operation steps: D drive -> Properties -> Security -> Add user IUSR_XXXXX OK
Case 2:
The problem is:
Warning: require_once(../lib/DBUtil.class.php) [function.require-once]: failed to open stream: No such file or directory in E:phpprodxhserviceExpertService.class.php on line 2
Fatal error: require_once() [function.require]: Failed opening required '../lib/DBUtil.class.php' (include_path='.;C:php5pear') in E: phpprodxhserviceExpertService.class.php on line 2
Solution:
1. Add dirname(__FILE__) when require, like this: require_once(dirname(__FILE__)."/../lib/DBUtil.class.php");
2. Understand the require_once instance as follows:
Copy to ClipboardQuoted content: [www.bkjia.com] //If b.php is referenced by a.php file require or include in other directoriesCase 3:
When running the php website, an error occurred. The content is as follows:
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/Register Login Module/index.php' (include_path='.;C:php5pear') in Unknown on line 0
File structure:
Solution:
apache cannot parse the Chinese URL of the "Registration Login Module" in the picture above, just change it to the English path.