【问题标题】:WAMP include_path errorsWAMP include_path 错误
【发布时间】:2013-06-07 10:41:51
【问题描述】:

我正在接一个由同事完成但需要改进的项目。我在 Windows PC 上安装了 WAMP 服务器,服务器上的大部分集成工作正常,除了我无法克服这个错误:

Warning: require_once(DB.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\includes\includes.inc.php on line 40

Fatal error: require_once() [function.require]: Failed opening required 'DB.php' (include_path='.;C:\php\pear') in C:\wamp\www\includes\includes.inc.php on line 40

首先我没有 C:\php\pear 文件夹,pear 文件夹位于

C:\wamp\bin\php\php5.3.13\pear

我在 WAMP 中停止了我的服务,然后转到 php.ini 并更改了这些设置:

; Windows: "\path1;\path2"
include_path = ".;C:\wamp\bin\php\php5.3.13\pear"

我检查了他的 .htaccess 文件是否有任何可能覆盖我的包含路径的内容,但什么也没有。

我在他的项目中看到他设置了 include_path 的唯一地方是:

ini_set('include_path', ini_get('include_path') . ':'. $_SERVER['DOCUMENT_ROOT'] ."/capeadmin/includes");

我似乎无法解决这个问题。

任何帮助都会非常感谢您!

【问题讨论】:

  • 您的问题看起来可能源于您的DB.php 文件。屏蔽您的用户/通行证/主机,并将代码提供给我们,以便我们查看。当您真正的意思是“includes/includes.inc.php”时,您似乎正在尝试包含“../includes/includes.inc.php”?
  • 我还没有配置 DB.php。我只是在命令提示符下进行了 go-pear 安装,仅此而已。

标签: php wamp pear include-path


【解决方案1】:

windows 的路径分隔符是; 而不是: 所以

ini_set('include_path', ini_get('include_path') . ':'. $_SERVER['DOCUMENT_ROOT'] ."/capeadmin/includes");

应该改为

ini_set('include_path', ini_get('include_path') . ';'. $_SERVER['DOCUMENT_ROOT'] ."/capeadmin/includes");

或者更好

ini_set('include_path', ini_get('include_path') .PATH_SEPARATOR. $_SERVER['DOCUMENT_ROOT'] ."/capeadmin/includes");

【讨论】:

  • 感谢您分享这个!但是,错误仍然存​​在。
  • 确保您要更改的 php.ini 是 wamp 安装中 apache/bin 目录中的那个....另一个是用于 php cli 脚本的
  • 我刚刚注意到他的配置方式,这家伙创建了自己的 DB.php 文件,而 PEAR-DB 没有。我已经通过电子邮件发送了这个问题。此问题将保持开放状态
  • 那是 apache/bin 的屏幕截图。它与 bin/php 相同。
猜你喜欢
  • 2013-02-25
  • 2015-01-05
  • 1970-01-01
  • 2011-11-01
  • 2018-06-02
  • 2016-04-06
  • 2012-10-30
  • 2012-11-07
  • 1970-01-01
相关资源
最近更新 更多