Changing the open_basedir with Plesk Linux

When needing to allow a less restrictive basedir setting in Plesk for a domain you could modify the sites vhost.conf file normally found or created in /var/www/vhosts/yourdomain.com/conf/ with something like:

<Directory /var/www/vhosts/yourdomain.com/httpdocs/>
php_admin_value open_basedir "/var/www/vhosts/yourdomain.com/httpdocs:/tmp:/php/includes"
</Directory>

Then run:

/usr/local/psa/admin/bin/websrvmng –reconfigure-vhost –vhost-name=yourdomain.com

Or to disable open_basedir you could put in:??

php_admin_value open_basedir none

PHP 4 apache module, Fedora 8 and Plesk 9

Some sites still require PHP 4 and for some reason do not work with PHP 5 and may not have the time to upgrade the scripts.

Useful links:

Download the latest PHP 4 source code from PHP.NET.

  • Make the directory: mkdir -p /opt/php-4.4.9
  • wget http://uk.php.net/get/php-4.4.9.tar.gz/from/this/mirror
  • tar -zxvf php-4.4.9.tar.gz
  • mv php-4.4.9 source
  • The configure statement used in this case was:
    ./configure –prefix=/opt/php-4.4.9/ –enable-versioning –with-layout=GNU –enable-libxml –with-libxml-dir=/usr/ –enable-reflection –enable-fastcgi –with-apxs2=/usr/sbin/apxs –with-regex=php –with-zend-vm=CALL –with-mysql=/usr –with-imap –enable-ftp –with-gd=/usr –with-pcre-regex=/usr –with-kerberos –with-imap-ssl –enable-memory-limit=yes –with-pear –with-zlib –enable-calendar –with-expat –with-png-dir=/usr –with-jpeg-dir=/usr –with-zlib-dir=/usr –with-freetype-dir=/usr –enable-sysvsem –enable-sysvshm –enable-exif –with-curl –enable-mbstring –enable-zend-multibyte –with-tiff-dir=/usr –with-gettext –enable-xml –with-ssl –with-mcrypt=../libmcrypt –with-mhash=../libmhash
  • If there were no problems: make && make install
  • Then, comment out the following line in: /etc/httpd/conf/httpd.conf
    #LoadModule php4_module        /usr/lib/httpd/modules/libphp4.so
  • In /etc/httpd/conf.d/php.conf comment out the PHP5 module and enable the PHP4 module:
    ##LoadModule php5_module modules/libphp5.so
    LoadModule php4_module        /usr/lib/httpd/modules/libphp4.so
  • The restart apache and check the websites: service httpd restart

This allows PHP4 to be ran as a module, however, if you want to use PHP5 you can use it via CGI in the Plesk 9 domain setting.