PHP脚本中include文件出错解决方法

yipeiwu_com6年前PHP代码库
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权限是否打开,该权限决定了目录能否被浏览。

相关文章

PHP中异常处理的一些方法整理

每一个新的功能添加到PHP运行时会创建一个指数随机数,通过这样的方式开发者可以使用和甚至滥用这个新特性。然而,直到一些好的和坏的使用情况陆续出现开发者们才达成了共识。当这些新案例不断浮现...

php函数传值的引用传递注意事项分析

本文实例讲述了php函数传值的引用传递注意事项。分享给大家供大家参考,具体如下: Strict standards: Only variables should be passed by...

PHP7.1新功能之Nullable Type用法分析

本文实例分析了PHP7.1新功能之Nullable Type用法。分享给大家供大家参考,具体如下: 在 PHP5 时代,PHP 的参数已经支持 type hint(除了基本类型),想必大...

php精确的统计在线人数的方法

这是一个非常精确的,通过php实现统计在线人数的方法,想知道怎么实现的请耐心阅读。 <?php $filename='online.txt';//数据文件 $coo...

PHP自动加载机制实例详解

本文实例讲述了PHP自动加载机制。分享给大家供大家参考,具体如下: 在php中,我们一般使用 require, requre_once, include, include_once 这四...