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 2Fatal 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命令,则可正确包含。找不到原因,请各位帮帮忙~~

解决方案 »

  1.   

    补充一下,环境为php 5.1.6, apache 2
      

  2.   

    phpinfo() 一下看看 php.ini 是不是是你指定的那个~~
      

  3.   

    phpinfo中include_path是我指定的位置
      

  4.   

    仔细看出错提示,看看错在哪如查定义了PHP.ini中的include_path(并指定了目录),则直接引用文件名
    如果没有指定,则可以用require_once("init/error_handler.inc.php")相对当前文件引用
    或者require_once("/init/error_handler.inc.php")从根目录开始此用
      

  5.   

    require_once(init/error_handler.inc.php)
    你用全路径引用试试