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.