By default, Plesk will install PEAR and a lot of packages, but block any access to it for PHP scripts. It’s fairly easy to enable this, though.
First of all, you need to edit the VirtualHost of whatever domain you’re trying to enable this for. Seeing as Plesk would just overwrite your httpd.conf with the next change you make in the controlpanel, you need to use a seperate vhost.conf file.
The file to edit can be found in the following directory:
It’s possible the file doesn’t exist, just go ahead and create it. If it does exist, simply edit it. If you’re trying to enable this for a subdomain only, you should edit the following file.
Once you’re editting the file vhost.conf, add the following lines.
<Directory /var/www/vhosts/<my domain>/httpdocs> php_admin_value include_path "/var/www/vhosts/<my domain>/httpdocs/:/usr/share/pear/" php_admin_value open_basedir "none" </Directory>
You can change the Directory-name to reflect whatever directory you’re trying to modify. For a subdomain, you should include the /subdomains/<subdomain-name>/ location as well.
The new vhost.conf only adds the location for the PEAR packages, being /usr/share/pear/. Make sure to keep your normal httpdocs directory in there too, otherwise your other includes will fail.
Now, you should let Plesk rebuild its configuration files in order to pick up the changes made in your vhost.conf, by running the following command.
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=my-domain-name
Replace “my-domain-name” with the actual domain name for which you want to enable PEAR. The command above will rebuild the vhost config for that specific domain. If you’re interested in rebuilding it for all your domains, you can use the shorter version.
/usr/local/psa/admin/sbin/websrvmng -a -v
At the beginning I said Plesk has a lot of PEAR Packages installed by default, and that’s true. They are however, in a different directory. You can find them all here.
You can copy any package you want or need to /usr/share/pear/, to enable them.
I suggest you update your PEAR packages before you get started, because Plesk may install quite a few of time, but they’re mostly outdated anyway. Grab your copies from the PEAR-website, and replace the files on your server.
That’s pretty much the simplest way to do it.