Install Second Version of PHP on Plesk

1. Download php from

2. Unpack the tarball to your home directory

tar -xjf php-5.2.10.tar.bz2

3. Get module list

php -m | grep -v -e Modules] -e ^$ > php-default-modules

4. Create a configure script

for i in $(cat php-default-modules); do echo -n “–with-$i “>> ;done

5. Edit and insert these 2 lines to the beginning of the file


6. Run the configure script


7. Correct the errors with the help of this command:

./configure –help

To correct the errors, you may need to replace ‘–with’ with ‘–enable’, and remove those modules that are enabled by default.

8. Add other options that you need, such as –enable-safe-mode

9. Create and run phpinfo.php

echo phpinfo();

10. Grab the configure entries from phpinfo.php. Remember not to include ‘–with-apxs2=/usr/sbin/apxs’, and Make sure to change ‘–with-config-file-path=/etc’ and ‘–with-config-file-scan-dir=/etc/php.d’.

A sample

./configure –prefix=/usr/share –datadir=/usr/share –libdir=/usr/lib64 –libexecdir=/usr/libexec –localstatedir=/var –sharedstatedir=/usr/com –mandir=/usr/share/man –infodir=/usr/share/info –cache-file=../config.cache –with-libdir=lib64 –includedir=/usr/include –bindir=/usr/bin –sbindir=/usr/sbin –sysconfdir=/etc –with-config-file-path=/etc/php52 –with-config-file-scan-dir=/etc/php.5.2.d –with-jpeg-dir=/usr –enable-force-cgi-redirect –enable-discard-path –with-bz2 –enable-calendar –enable-exif –enable-ftp –with-gd –with-gettext –with-gmp –with-iconv –enable-mbstring –with-mcrypt –with-mysql=/usr/bin/ –with-mysqli –with-openssl –with-pdo_mysql –with-PDO_ODBC –with-pdo_sqlite –enable-shmop –enable-sockets –with-xmlrpc –with-xsl –enable-zip –with-zlib

11. Run ./ again until all errors are fixed.

12. Run ‘make’.

13. Fix the errors.

14. Run ‘make’ again until all errors are fixed.

15. Duplicate php.ini

mkdir /etc/php52/
cp php.ini-dist /etc/php52/php.ini

16. Duplicate the additional .ini files

mkdir /etc/php.5.2.d
cp /etc/php.d/*.* /etc/php.5.2.d/

17. Change permission of the cgi-bin folder

chmod 755 /var/www/vhosts/

18. Copy the php-cgi to the cgi-bin folder

cp sapi/cgi/php-cgi /var/www/vhosts/
chown domain.psacln /var/www/vhosts/
chmod 755 /var/www/vhosts/

19 . Create the apache config file

vim /var/www/vhosts/
ScriptAlias /cgi-bin/ /var/www/vhosts/
Action php52-cgi /cgi-bin/php-cgi
AddHandler php52-cgi .php

20. Ask Plesk to reconfigure the domain

/usr/local/psa/admin/bin/httpdmng –reconfigure-domain