How To Enable PEAR Packages In Plesk
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:
/var/www/vhosts/<my domain>/conf/vhost.conf
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.
/var/www/vhosts/<my domain>/subdomains/<subdomain-name>/conf/vhost.conf
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.
/usr/share/psa-pear/
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.
Thanks for the information, Very helpful
You can also add a default for future domains in
/var/www/vhosts/.skel/0/conf/vhost.conf
php_admin_value include_path “/var/www/vhosts/@domain_name@/httpdocs/:/usr/share/pear/”
php_admin_value open_basedir “none”
hy
thany you for these informations, but it doesn’t work with my configuration (plesk 9 – cent os).
when I do a phpinfo, i see in the “configure command” ‘–without-pear’
must I recompile php ?
is it riskless ?
thank you
good stuff mate, that did the trick. BTW I am running plesk 9 + cent os 5 and this does work for me. I didn’t read it properly to being with and almost edited the httpd.include instead of creating a vhost.conf file. Also you can’t just reset your VPS container, you do need to execute
/usr/local/psa/admin/sbin/websrvmng –reconfigure-vhost –vhost-name=my-domain-name
…
Great! Solved the problem on Fedora Core 7 x86.
That didn’t do the trick for me. I reconfigured the host, reconfigured all hosts, restarted apache, still not working. Damn this plesk is messy and sucks.
Enormously helpful, thank you. Saved me hours I’m sure!