PHP脚本中include文件出错解决方法
程序员文章站
2022-04-10 22:48:25
...
1. 出现“未找到文件“类似的错误时候,检查include文件的位置是否正确,下面引用php手册页面的原话:
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. 当出现permission deny 类似错误的时候,按以下方法排除
a) 检测被包含的文件读权限是否打开
b) 检测被包含的文件路径上的每个目录的x权限是否打开,该权限决定了目录能否被浏览。
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. 当出现permission deny 类似错误的时候,按以下方法排除
a) 检测被包含的文件读权限是否打开
b) 检测被包含的文件路径上的每个目录的x权限是否打开,该权限决定了目录能否被浏览。
推荐阅读
-
html网页中插入script脚本,src指向php文件,怎么在html中显示php返回的数据?求大神赐教。
-
php提取csv格式文件中的字符串出现的有关问题及解决方法
-
c#中XML解析文件出错解决方法
-
实测在class的function中include的文件中非php的global全局环境
-
php命令行(cli)下执行PHP脚本文件的相对路径的问题解决方法
-
php做下载文件的实现代码及文件名中乱码解决方法
-
实测在class的function中include的文件中非php的global全局环境
-
跨浏览器PHP下载文件名中的中文乱码问题解决方法
-
php命令行(cli)下执行PHP脚本文件的相对路径的问题解决方法
-
PHP中file_get_contents函数抓取https地址出错的解决方法(两种方法)