Applicable to:
- Plesk for Linux
Question
A website application requires PEAR (PHP Extension and Application Repository) but it shows PEAR is not installed.
How to enable PEAR support for a domain in Plesk?
Answer
-
Go to Plesk > Domains > example.com > PHP settings > Common settings > Make sure that the
include_path
directive includes PEAR folder path relative to the selected PHP version. For example, if Plesk PHP 7.3 is selected, the PEAR folder is located in:CONFIG_TEXT: .:/opt/plesk/php/7.3/share/pear
Click here to expand image -
Copy PEAR folder path from
include_path
and append it inopen_basedir
directive as follows:CONFIG_TEXT: {WEBSPACEROOT}{/}{:}{TMP}{/}:/opt/plesk/php/7.3/share/pear
Click here to expand image -
Finally, check if PEAR was enabled correctly creating the
pear.php
file in the website public directory with the following content:CONFIG_TEXT: <?php
require_once 'System.php';
if (class_exists('System')) {
echo 'PEAR is enabled';
} else {
echo 'PEAR is NOT enabled';
};
?>
Additional Information
How to change PHP parameter for all domains on Plesk server?
Comments
13 comments
These instructions are hard to understand, need to be rewritten
@Scott, article was edited.
Probably best to expand a little on the explanations, for example, the include directive may have already been altered previously for some plugin or app, and so having the statement `Set the following value for
include_path` is not quite right. Maybe use `change` or `ensure the path includes the values`.
`Add the following to
open_basedir` seems good enough an explanation, bearing in mind the on page instructions already found on the php settings form.
The two items that state `(use
path
from step 1):` need to be removed as they are misleading and incorrect.However, I found this to be a useful nugget of information, as I have previously had to load PEAR manually in the past, and this is so much easier. Thanks Guys.
Hello @Darren,
Thank you for the feedback.
I'm glad that this article was helpful.
The article will be reviewed.
I need to send mail trough PHP pear smtp mail functions, I am not sure if I need to manually install php-pear-Mail.noarch or it should already be installed since I have the /usr/share/pear with pear files there.
Hello @adrianTNT
If pear is already installed you could check installed modules by the following command:
pear list
pear list-all will list all packages, packaged and/or available. To install the package the command 'pear install' should be used.
Additional details here: https://pear.php.net/manual/en/guide.users.commandline.commands.php
I think the path is /usr/share/psa-pear/pear and not /usr/share/pear.

@Martin Schaible
The path should be the same as in the output of this command:
/usr/share/psa-pear/pear/pear config-get php_dir
It may be different depending on the configuration.
I think that this article is outdated and does not match the standard configuration of plesk onyx, at least with CloudLinux.

The value for include_path is set to .:/opt/plesk/php<version>/share/pear and shouldn't be changed, i guess.
@Martin Schaible
Include_path varies between the different PHP versions. The article shows the include_path for OS PHP version. When switching to Plesk PHP version, e.g. PHP 7.2, the include_path changes to /opt/plesk/php/7.2/share/pear accordingly.
Hi,
As you know Plek has multiple PHP versions installed.
If you want to update pear and pecl automatically for all PHP versions, you can use the following script:
- create a file:
vi update_pear_pecl
- insert the following script:
pear clear-cache
pear update-channels
pear upgrade
pear upgrade-all
pear clear-cache
pear update-channels
pear upgrade
pear upgrade-all
curdir=$(pwd)
for folder in /opt/plesk/php/*; do
[ -d "$folder" ] && cd "$folder" && echo "$folder" && ./bin/pecl clear-cache && ./bin/pecl update-channels && ./bin/pecl upgrade && ./bin/pear clear-cache && ./bin/pear update-channels && ./bin/pear upgrade
done
cd $curdirr
- make file executable:
chmod u+x update_pear_pecl
- run script:
./update_pear_pecl
Hello, i have set the open_basedir on the Plesk PHP Settings Gui to none and it has worked for me.
Daniel
Ioan Suceveanu and Daniel Jimenez, thank you for sharing this info here, it may be helpful for some other Plesk users!
Please sign in to leave a comment.