Add to Favourites Add to Favourites    Print this Article Print this Article

Can I run PHP4 & PHP5 at the same time ?

Question 1) How do I set this up?

The PHPSuExec option is not available in Easy Apache 3. Rather it uses the regular suExec capabilities of Apache. Also, suPHP is available for both PHP 4 and 5, in all versions of Apache. There are several ways to have a PHP 4 + PHP 5 setup. A new configuration page is available in WHM to allow you to configure some of the global setup.

Specifically, the Configuration page allows you (the admin) to specify: There is a special new method in EA3 called Concurrent PHP, which one must manually select in EA3. This allows the use of PHP 4 + PHP5 as Apache modules (i.e. both libphp4 and libphp5 are loaded). The same configuration page mentioned will allow yo uto specify which is the system wide default.

suPHP will give users the same benefit as PHPSuExec: the ability to customize PHP by use of a local php.ini file. Unlike PHPSuExec though, suPHP is configurable at runtime by the WHM Admin, using the configuration file in /opt/suphp/etc/

Question 2) Which version of PHP4/PHP5 is running perfect/okay/problem free now?

The answer to this in part depends upon which 3rdparty extensions you need. For example, many people seem to have issues with Zend Opt 3.3.0 and PHP 5.2.2+ As incompatibilities are identified, we document them in the EA 3 interface. For example, the Suhosin patch is not compatible with Concurrent PHP, and is noted in the interface. We also do some dependency resolution before the build, to skip extensions that are known to be incompatible, in case a user ignores the warning in the interface.

Question 3) At the end user's cPanel, which PHP version will be display?

It's supposed to show whatever is set as the system default.

Question 4) How can end-users choose to use a specific version of PHP?

Right now the only way an end user can choose is by renaming their scripts. For example, if the Admin specifies PHP 5 to be the default, and the user needs PHP 4 for some scripts, renaming the scripts to be .php4 will execute using the PHP 4 handler.

We are currently working on a method that allows an end user more control over this as file renaming is rather awkward for a major application. Once this is tested and available, the user's cPanel should show what he has chosen for default.

Until that tool is available, the end user can over-ride by use of .htaccess — which we don't recommend. The Admin can also specify overrides by the use of VirtualHost includes. This entails including a configuration file fragment in the vhost, for example: Include "/usr/local/apache/conf/userdata/std/2/user/custom.conf">

Documentation is in the process of being prepared to fully explain the use of vhost includes. In short, one would place the configuration fragment file in: /usr/local/apache/conf/userdata/std/2/ or /usr/local/apache/conf/userdata/std/2/user/

(Note: these directories might need to be created.) Then execute the /scripts/ensure_vhost_includes script. --help will explain the use of the script.

The specific Addhandler mime-types used to do overrides will depend upon the specific PHP setup and handler configuration.

Question 5) Are they (PHP5+PHP4) available for Apache 2.X.X?

PHP 4 + PHP 5 combinations are available for Apache 1.3, 2.0 and 2.2 The Concurrent PHP and the PHP Configuration page in WHM are both relatively new.

As far as which Apache version we recommend, we cannot give that answer. In part it depends upon your needs. Apache 2.2 is where all new developments will happen. 2.0 and 1.3 will only receive fixes. Due to the threading changes and issues with PHP 4, Apache 1.3 is highly recommended for that specific version of PHP4, however it will work adequately with 2.0 and 2.2 with the preform MPM.

Was this answer helpful?

Also Read