Search code examples
phppear

Pear Packages not working


I've been trying to use a few PEAR packages for a few hours now to no avail. PEAR itself is functioning, and I believe I set all of the configuration variables correctly, but when I try to run any of my packages from the command line, I get PHP errors telling me the required file wasn't found. For example, with phpdoc:

$ phpdoc
PHP Warning:  require(PhpDocumentor/phpDocumentor/phpdoc.inc): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/pear/bin/phpdoc on line 40

Warning: require(PhpDocumentor/phpDocumentor/phpdoc.inc): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/pear/bin/phpdoc on line 40
PHP Fatal error:  require(): Failed opening required 'PhpDocumentor/phpDocumentor/phpdoc.inc' (include_path='.:/Applications/MAMP/bin/php5.2/lib/php') in /Applications/MAMP/htdocs/pear/bin/phpdoc on line 40

Fatal error: require(): Failed opening required 'PhpDocumentor/phpDocumentor/phpdoc.inc' (include_path='.:/Applications/MAMP/bin/php5.2/lib/php') in /Applications/MAMP/htdocs/pear/bin/phpdoc on line 40

I tried manually editing the files, inserting the absolute path to the files, but when I correct one require error a new one just comes up.

This is my pear.conf:

#PEAR_Config 0.9
a:15:{s:10:"__channels";a:2:{s:12:"pecl.php.net";a:0:{}s:5:"__uri";a:0:{}}s:15:"preferred_state";s:6:"stable";s:8:"temp_dir";s:35:"/Applications/MAMP/htdocs/pear/temp";s:7:"bin_dir";s:34:"/Applications/MAMP/htdocs/pear/bin";s:7:"php_dir";s:35:"/Applications/MAMP/htdocs/pear/PEAR";s:7:"doc_dir";s:40:"/Applications/MAMP/htdocs/pear/PEAR/docs";s:8:"data_dir";s:40:"/Applications/MAMP/htdocs/pear/PEAR/data";s:8:"test_dir";s:41:"/Applications/MAMP/htdocs/pear/PEAR/tests";s:9:"cache_dir";s:41:"/Applications/MAMP/htdocs/pear/PEAR/cache";s:9:"cache_ttl";i:300;s:12:"download_dir";s:44:"/Applications/MAMP/htdocs/pear/temp/download";s:10:"http_proxy";s:0:"";s:7:"ext_dir";s:74:"/Applications/MAMP/bin/php5.2/lib/php/extensions/no-debug-non-zts-20050922";s:7:"php_bin";s:37:"/Applications/MAMP/bin/php5.2/bin/php";s:10:"sig_keydir";s:39:"/Applications/MAMP/conf/php5.2/pearkeys";}

PEAR Config

I'm using MAMP PRO v1.9.5 on Mac OS 10.7.5 with PHP v5.2.17. Also, I installed the packages with the PEAR web interface package manager. If any further information is required, please let me know and I'll post it.


Solution

  • Make sure that the include path contains the folder where PEAR installs php class files. Check your include_path ini setting. It should look like:

    include_path=".:PEAR_CLASSES_PATH"
    

    where PEAR_CLASSES_PATH is the pear class path