PHP脚本中include文件出错解决方法
程序员文章站
2022-06-15 23:23:47
1. 出现“未找到文件“类似的错误时候,检查include文件的位置是否正确,下面引用php手册页面的原话: files for including are first l...
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权限是否打开,该权限决定了目录能否被浏览。
推荐阅读
-
实测在class的function中include的文件中非php的global全局环境
-
php命令行(cli)下执行PHP脚本文件的相对路径的问题解决方法
-
php做下载文件的实现代码及文件名中乱码解决方法
-
实测在class的function中include的文件中非php的global全局环境
-
跨浏览器PHP下载文件名中的中文乱码问题解决方法
-
php命令行(cli)下执行PHP脚本文件的相对路径的问题解决方法
-
PHP中file_get_contents函数抓取https地址出错的解决方法(两种方法)
-
php使用strpos判断字符串中数字类型子字符串出错的解决方法 原创
-
PHP中file_exists()判断中文文件名无效的解决方法
-
浅谈php中include文件变量作用域