Tuesday, February 16, 2010

Enabling PEAR by setting your open_basedir and include_path

SkyHi @ Tuesday, February 16, 2010

Here's how to enable pear on a domain:

1) SSHSecure Shell or ssh is a network protocol that allows data to be exchanged over a secure channel between two computers.'); return false;">SSH into your PleskPlesk is a software package which allows a server administrator to set up new websites, e-mail accounts, and DNS entries through a web-based interface. The administrator can create client and site templates, which predetermine resource allocation parameters for the domains and/or clients.'); return false;">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.

viVim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems.'); return false;">vi vhost.conf

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


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"

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

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"

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 apacheAn open source Web server that is freely available and can be modified by programmers.'); return false;">apache, this can be done through Plesk or by executing the following commands:

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

REFERENCE
http://kb.mediatemple.net/questions/514/Enabling+PEAR+by+setting+your+open_basedir+and+include_path