Troubleshooting PEAR errors


This guide assumes you've already installed PEAR using the following guide:

It’s possible your PHP site will throw an error if certain PEAR packages are not installed. For example, if you get an error referencing any of the following, run the command below (in your users directory) to install that package.

Error reference Command to fix
[server]$ pear install --alldeps Mail
[server]$ pear install --alldeps Mail_Mime
[server]$ pear install --alldeps Console_Getopt
[server]$ pear install --alldeps MDB2
[server]$ pear install --alldeps Net_SMTP

Script errors

When you create a script that references PEAR, make sure to add these two lines at the very top of that script:

error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);
set_include_path("." . PATH_SEPARATOR . ($UserDir = dirname($_SERVER['DOCUMENT_ROOT'])) . "/pear/php" . PATH_SEPARATOR . get_include_path());
  • The first line turns off any errors that may show.
  • The second line allows the script to reference your PEAR installation.

Additionally, you may need to include the configuration file that you created. The configuration file includes variables for template and data path, which are required for some PEAR modules:

$pear_user_config = $UserDir . "/.pearrc";

Where $UserDir = dirname($_SERVER['DOCUMENT_ROOT']) dynamically determines your DreamHost home directory, e.g., '/home/user'.

Installation error

You may see the following error after attempting to install a package:

[server]$ pear install --onlyreqdeps Mail
No releases available for package ""
install failed

To fix this error, view the following article section:

See also

Did this article answer your questions?

Article last updated PST.