我的 include_path OSX 10.6.6 可能存在问题PHP 5.3.3 +梨

发布于 2024-10-18 11:13:36 字数 3125 浏览 1 评论 0原文

好吧,我想在开始之前我应该​​说,当涉及到 OSX/BSD 主题时,我是一个十足的菜鸟。我在过去一周左右才进行了 MBP,并且一直在学习 HEAPS。尽管如此,我仍然在努力思考一些事情,所以,请保持温柔。 :)

好吧,解决我的问题。这几天我一直在尝试设置本地开发环境。我已经激活了操作系统附带的 Apache 2.2 和 PHP 5.3.3。我还手动安装了 MySQL、Homebrew 并设置了 BIND(以便更轻松地进行虚拟主机管理)。一切似乎都运行得很好,直到我意识到我还必须安装 PEAR。

不幸的是,我公司产品中的许多关键领域都严重依赖 PEAR 库,因此我必须确保在继续之前所有这些都已启动并运行。要安装 PEAR,我执行了以下操作:

  1. $ cd /usr/local/
  2. $ curl http://pear.php .net/go-pear | sudo php
  3. $ php -q go-pear.php
  4. 执行 PEAR 安装说明
  5. $ mate ~/.bash_profile
  6. 将 /usr/local/bin 添加到我的 $PATH 变量
  7. 保存并关闭 TextMate
  8. $ which pear (验证 PEAR 可执行文件的位置)
  9. $ php -r "phpinfo();" | grep '.ini' (验证当前 php.ini 的位置)
  10. $ mate /etc/php.ini
  11. 将 'include_path' 设置更改为:“.:/usr/local/PEAR”
  12. 保存并关闭 TextMate
  13. $ sudo apachectl restart
  14. 满意得到结果后,我开始安装一些必要的 PEAR 包(HTTP、NET 等),

然后检查完​​我们的 SVN 存储库之一的最新版本并安装该应用程序。我尝试通过浏览器访问它并收到以下错误:

 Warning: require_once(HTTP/Request2.php): failed to open stream: No such file or directory in /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/apps/Mpx/Poller.class.php on line 8

Call Stack:
    0.0003     651400   1. {main}() /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/call.php:0
    0.0028     927096   2. RXML_Config::autoload() /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/config/autoload.php:0
    0.0040    1144272   3. require_once('/Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/apps/Mpx/Poller.class.php') /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/config/autoload.php:18


Fatal error: require_once(): Failed opening required 'HTTP/Request2.php' (include_path='.:/usr/local/PEAR;/Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/Library/Pear/') in /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/apps/Mpx/Poller.class.php on line 8

Call Stack:
    0.0003     651400   1. {main}() /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/call.php:0
    0.0028     927096   2. RXML_Config::autoload() /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/config/autoload.php:0
    0.0040    1144272   3. require_once('/Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/apps/Mpx/Poller.class.php') /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/config/autoload.php:18

我可以验证这些文件的位置。它们确实存在并且位于正确的目录中。我的理解是,使用“.:/usr/local/PEAR”的“include_path”,PHP 首先在与调用脚本相同的目录中查找,如果没有找到任何内容,它将移动到列表中的下一个路径。在最后一种情况下,它应该是 /usr/local/PEAR,但它什么也没出现。

我从错误报告中看到的唯一奇怪的事情是第二部分中的以下位:

(include_path='.:/usr/local/PEAR;/Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/Library/Pear/')

在“.:/usr/local/PEAR”之后有一个分号,并附加了另一个(有效)路径。我并不担心这个特定的路径,但我担心分号会导致 PHP 认为第一个冒号之后的所有内容都是单个路径。如果是这样的话,PHP 找不到 PEAR 库就说得通了。

鉴于我所提到的内容,其他人是否可以想到任何原因或对此事提供任何见解?谢谢堆!

编辑:

好的,这个问题已经解决了。我确实在终端中执行了以下命令:

$ grep -r -i ini_set("include_path {path/to/project}

Aaa并且我发现了以下内容:

ini_set("include_path", ini_get("include_path") . ";" . __CONFIG_PATH_LIBRARY_PEAR);

替换“;”使用 PATH_SEPARATOR 很好地解决了这个问题。

感谢雅各布! :)

Ok, I think before I start I should just say that I'm a complete n00b when it comes to topic of OSX/BSD. I've only had my MBP for the past week or so and have been learning HEAPS. Though, despite this, I'm still trying to wrap my head around a few things, so, please, be gentle. :)

Alright, on to my problem. I've been trying to setup my local development environment now for a few days. I have activated Apache 2.2 and PHP 5.3.3 which came with the OS. I have also manually installed MySQL, Homebrew and setup BIND (for easier vhost management). Everything appeared to be working quite well until I realize I had to also install PEAR.

Unfortunately, a lot of critical areas within my company's products rely heavily on the PEAR library, so I had to make sure that was all up-and-running before continuing. To install PEAR, I did the following:

  1. $ cd /usr/local/
  2. $ curl http://pear.php.net/go-pear | sudo php
  3. $ php -q go-pear.php
  4. Go through the PEAR install instructions
  5. $ mate ~/.bash_profile
  6. Added /usr/local/bin to my $PATH variable
  7. Saved and closed TextMate
  8. $ which pear (verified the location of PEAR executable)
  9. $ php -r "phpinfo();" | grep '.ini' (to verify locate of current php.ini)
  10. $ mate /etc/php.ini
  11. Changed 'include_path' setting to: ".:/usr/local/PEAR"
  12. Saved and closed TextMate
  13. $ sudo apachectl restart
  14. Happy with the results, I begin installing a few essential PEAR packages (HTTP, NET, etc..)

I then finish checking out the latest revision of one of our SVN repositories and install the app. I attempt to access it via the browser and get an error to the following effect:

 Warning: require_once(HTTP/Request2.php): failed to open stream: No such file or directory in /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/apps/Mpx/Poller.class.php on line 8

Call Stack:
    0.0003     651400   1. {main}() /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/call.php:0
    0.0028     927096   2. RXML_Config::autoload() /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/config/autoload.php:0
    0.0040    1144272   3. require_once('/Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/apps/Mpx/Poller.class.php') /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/config/autoload.php:18


Fatal error: require_once(): Failed opening required 'HTTP/Request2.php' (include_path='.:/usr/local/PEAR;/Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/Library/Pear/') in /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/apps/Mpx/Poller.class.php on line 8

Call Stack:
    0.0003     651400   1. {main}() /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/call.php:0
    0.0028     927096   2. RXML_Config::autoload() /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/config/autoload.php:0
    0.0040    1144272   3. require_once('/Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/apps/Mpx/Poller.class.php') /Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/config/autoload.php:18

I can verify the location of these files. They DO exist and are in the proper directory. My understanding is that with the 'include_path' of '.:/usr/local/PEAR' PHP first looks in the same directory as the calling script, if nothing is found, it moves to the next path in the list. In the last case, it SHOULD be /usr/local/PEAR, but it comes up with nothing.

The only odd thing I can see from the error report is the following bit in the second section:

(include_path='.:/usr/local/PEAR;/Users/wilhelm/Sites/wrk/t-box-3a-rxml/public/Library/Pear/')

After '.:/usr/local/PEAR' there is a semi-colon and another (valid) path is appended to it. I'm not worried about this particular path, but I'm concerned the semi-colon is causing PHP to think everything after the first colon is a single path. If that's the case, it would make sense that PHP can't find the PEAR libraries.

Given what I've mentioned, could anyone else think of any reason or provide any insight into this matter? Thanks HEAPS!

EDIT:

Alright, this has been resolved. I did executed the following command in the terminal:

$ grep -r -i ini_set("include_path {path/to/project}

Aaaand I found the following:

ini_set("include_path", ini_get("include_path") . ";" . __CONFIG_PATH_LIBRARY_PEAR);

Replacing the ";" with PATH_SEPARATOR fixed the problem nicely.

Thanks go out to Jacob! :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故事和酒 2024-10-25 11:13:36

在您的项目中搜索 set_include_path 或 public/Library/Pear/

看起来您可能会在某处添加包含路径,并使用分号而不是 PHP 常量 PATH_SEPARATOR,这将为您的操作系统提供正确的分隔符。

Search your project for set_include_path or public/Library/Pear/

It appears like you may be adding to the include path somewhere, and used a semi-colon instead of the PHP constant PATH_SEPARATOR, which will give you the correct separator for your OS.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文