Wilhelm Murdoch
Wilhelm Murdoch

Reputation: 1816

Possible issue with my include_path OSX 10.6.6 + PHP 5.3.3 + PEAR

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! :)

Upvotes: 1

Views: 1668

Answers (1)

Jacob
Jacob

Reputation: 8334

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.

Upvotes: 1

Related Questions