I am encountering an unusual error on Mac OSx
[Sun Dec 15 18:13:10 2013] [error] [client 127.0.0.1] PHP Fatal error: Class 'PEAR_Exception' not found in /path/file.php on line 102
I am sure that i have the extension 'Pear' installed. (Simply running "pear" on the terminal does not show a "command not found" error)
What could have caused this error ?
To use PEAR and PEAR compatible packages in your applications, you normally include them into your PHP scripts using require_once()
. For this to work, PEAR's directory must be a part of PHP's include_path
.
You can check PHP's include path
with <?php phpinfo();
and look for include_path
. On Mac OS X, PEAR is installed in /usr/lib/php/PEAR
by default.
Once you have verified that PEAR is installed and included in PHP's include_path
, you can include the needed PEAR package using require_once()
. You must do this before using any function associated with that package or you will get an error.
PHP Fatal error: Class 'PEAR_Exception' not found in /path/file.php on line 102
For example you need to do require_once 'PEAR/Exception.php';
before you can use the package PEAR_Exception.