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.

Spread the word
If you liked the content of this article, please vote for it on the following websites - thanks.
  • Facebook
  • Twitter
  • del.icio.us
  • LinkedIn
  • DZone
  • Reddit
  • Digg
  • StumbleUpon
  • Sphinn
This entry was posted in Plesk and tagged , , . Bookmark the permalink.

12 Responses to How To Enable PEAR Packages In Plesk

  1. Thanks for the information, Very helpful

  2. Pingback: Recent Faves Tagged With "plesk" : MyNetFaves

  3. Pingback: Install New PEAR Packages From The Linux CLI ~ Mattias Geniar

  4. Pingback: Enabling PEAR for PHP in Plesk (GoDaddy virtual dedicated)

  5. Me says:

    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”

  6. matthieu says:

    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

  7. Jeremy says:

    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

  8. Alex says:

    Great! Solved the problem on Fedora Core 7 x86.

  9. 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.

  10. Enormously helpful, thank you. Saved me hours I’m sure!

  11. Pingback: PEAR

  12. BK says:

    New to all this, i would like to know how and where can i access this directory?
    I tried doing it on my FTP then in my FILE MANAGER please help.

    I need to install PEAR DB

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">