centOS下,已经设置了include_path, require_once失败

Pigwen 2008-07-30 01:18:08
centOS下,使用yum安装的apache和php。在文档根目录下的index.php中调用了一个位于include_path中的文件。
通过浏览器访问index.php的时候,错误提示如下:

Warning: require_once(init/error_handler.inc.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/html/heroesweb/index.php on line 2

Fatal error: require_once() [function.require]: Failed opening required 'init/error_handler.inc.php' (include_path='/usr/share/pear:/usr/share/php:/home/kwen/heroesweb/src/php/shared:/home/kwen/heroesweb/src/php/shared/libs') in /var/www/html/heroesweb/index.php on line 2

但是,如果在shell中使用php index.php命令,则可正确包含。

找不到原因,请各位帮帮忙~~
...全文
334 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
helloyou0 2012-08-04
  • 打赏
  • 举报
回复
你那文件在哪? 全路径贴出来
franzhong 2012-08-04
  • 打赏
  • 举报
回复
路径问题,使用个绝对路径测试一下
蓝色的雨哎 2012-08-03
  • 打赏
  • 举报
回复
require_once(init/error_handler.inc.php)
你用全路径引用试试
moonshiny007 2012-08-03
  • 打赏
  • 举报
回复
我也遇到了这个问题,很诡异。。一下午了还没解决
fxs_2008 2008-07-30
  • 打赏
  • 举报
回复
仔细看出错提示,看看错在哪

如查定义了PHP.ini中的include_path(并指定了目录),则直接引用文件名
如果没有指定,则可以用require_once("init/error_handler.inc.php")相对当前文件引用
或者require_once("/init/error_handler.inc.php")从根目录开始此用
lvjx125 2008-07-30
  • 打赏
  • 举报
回复
帮你顶
Pigwen 2008-07-30
  • 打赏
  • 举报
回复
phpinfo中include_path是我指定的位置
mikespook 2008-07-30
  • 打赏
  • 举报
回复
phpinfo() 一下看看 php.ini 是不是是你指定的那个~~
zgycsmb 2008-07-30
  • 打赏
  • 举报
回复
帮你顶。。
Pigwen 2008-07-30
  • 打赏
  • 举报
回复
补充一下,环境为php 5.1.6, apache 2

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧