failed to open stream: No such file or directory 问题大全
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] //如果b.php被其他目录里的a.php文件require 或者 include 去引用的话require_once("./c.php"); //实际上调用的是a.php目录下的c.php
require_once(dirname(__FILE__)."/c.php"); //实际上调用的是b.php目录下的c.php
require_once("c.php"); //实际上调用的是b.php目录下的c.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
文件结构:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Chinese version
Chinese version, very easy to use

SublimeText3 Mac version
God-level code editing software (SublimeText3)
