Support / KnowledgeBase

 
Search the KnowledgeBase Search

Enabling PEAR by setting your open_basedir and include_path

  • Applies to: All (dv)

  • Difficulty: Easy

  • Time needed: 5 minutes

  • Tools needed: root, ssh, vi knowledge

 

Pear comes installed on your (dv) Dedicated-Virtual Server, but to enable it on one of your domains you'll have to change the default open_basedir variable.

To change the default of this variable you'll need root access which you can ask for in the AccountCenter if you don't already have it.

NOTE:

Text in this color is used as an example. Please be sure to replace this text with the proper information for your site or server.

Please be aware that the following changes in your vhost.conf file will take precedence over any settings you may have in your httpd.conf file.

Here's how to enable pear on a domain:

1) SSH into your Plesk machine as "root" and cd to the conf directory for the domain on which you want to enable pear. Something like this should work:

For (dv) Dedicated-Virtual Server v2.0 systems:

cd /home/httpd/vhosts/mt-example.com/conf/
For (dv) Dedicated-Virtual Server v3.x systems:

cd /var/www/vhosts/mt-example.com/conf/

2) Create a file called vhost.conf using the vi editor with the following contents:

NOTE:

If you wish to make PEAR available via https follow the instructions below, but create "vhost_ssl.conf" instead of "vhost.conf". If you wish to enable this for subdomains you must create the appropriate vhost.conf files for all subdomains that you need and then reconfigure the main vhost.conf file.

vi vhost.conf

For (dv) Dedicated-Virtual Server v2.0 systems:


<Directory "/home/httpd/vhosts/mt-example.com/httpdocs">
php_admin_value open_basedir "/home/httpd/vhosts/mt-example.com/httpdocs:/usr/share/pear:/tmp"
php_admin_value include_path ".:/usr/share/pear"
</Directory>

For (dv) Dedicated-Virtual Server v3.x systems:

<Directory "/var/www/vhosts/mt-example.com/httpdocs">
php_admin_value open_basedir "/var/www/vhosts/mt-example.com/httpdocs:/usr/share/pear:/tmp"
php_admin_value include_path ".:/usr/share/pear"
</Directory> 

TIP:

If you want to switch off safe_mode on a per domain basis you can add the following line:


  php_admin_value safe_mode Off 

NOTE:

If you are having open_basedir problems not related to the use of PEAR you should add the path of the directory you are trying to access after :/tmp like this:

For (dv) Dedicated-Virtual Server v2.0 systems:

 php_admin_value open_basedir "/home/httpd/vhosts/mt-example.com/httpdocs:/usr/share/pear:/tmp:/path/to/new/directory/to/access/" 
For (dv) Dedicated-Virtual Server v3.x systems:
 php_admin_value open_basedir "/var/www/vhosts/mt-example.com/httpdocs:/usr/share/pear:/tmp:/path/to/new/directory/to/access/" 

Or you can try turning off open_basedir completely like this:
  php_admin_value open_basedir none 

3) Reconfigure your webserver so it will look for your new vhost.conf file by doing this:

  /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=mt-example.com

4) Finally you must restart apache, this can be done through Plesk or by executing the following commands:

/etc/init.d/httpd stop
/etc/init.d/httpd start

Revisions:

07-07-2009: Added note about using https with a vhost_ssl.conf file
03-05-2009
: Fixed spelling error. Thanks Sharon C. for the comment.

User Comments

No visitor comments posted. Post a comment

Fields marked with an asterisk(*) are required. Comment on this article

Fill out the form below if you would like to comment on this article.
 
 
 

(code is not case-sensitive)
 
Submit
 
 

Continue