Home > Plesk > How To Enable PEAR Packages In Plesk

How To Enable PEAR Packages In Plesk

August 20th, 2008

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.
  • Digg
  • del.icio.us
  • DZone
  • Reddit
  • StumbleUpon
  • Sphinn
  • Facebook
  • Live
  • Mixx
  • Technorati
  • TwitThis

Matti Plesk , ,

  1. August 21st, 2008 at 00:02 | #1

    Thanks for the information, Very helpful

  2. Me
    May 15th, 2009 at 04:35 | #2

    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”

  3. matthieu
    June 11th, 2009 at 10:18 | #3

    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

  4. August 26th, 2009 at 09:53 | #4

    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

  5. September 17th, 2009 at 19:52 | #5

    Great! Solved the problem on Fedora Core 7 x86.

  6. October 30th, 2009 at 22:31 | #6

    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.

  7. January 12th, 2010 at 17:54 | #7

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

  1. September 17th, 2008 at 21:05 | #1
  2. January 24th, 2009 at 19:28 | #2
  3. March 5th, 2009 at 14:33 | #3
  4. February 17th, 2010 at 15:47 | #4