Depending on your Drupal version, php 4.4.0 up to php 5.2.x can be required (see requirements here).

Some of the oldest Drupal versions will only work with php 4 (ex.: Drupal 4.3.2), while numerous newer modules will rarely work on php 4 (you may get an error such as: Parse error: syntax error, unexpected T_VARIABLE ).

If your hosting service has both php 4 and php 5 available, which is almost always the case, you can easily choose which version should be used by your Drupal installations.

For example, you can have an older site running on php 4 and, on the same hosting account, have another running on php 5.

HOW TO :

In the .htaccess file of a given Drupal installation, simply add (preferably as the first item) :

AddHandler application/x-httpd-php5 .php
or...
AddHandler application/x-httpd-php4 .php

That's it.

Note that Cpanel usually gives you the option to select the default running PHP version, but this does not cause any problems. You can select PHP 4 as the default in the Cpanel, and nonetheless invoke PHP 5 in the .htaccess of a given Drupal installation.

Comments

Vako’s picture

When I do that for my Drupal 6 installation and then access the URL, it prompts me to save a file.
I would like to have an old version of a site (PHP 5.x) to co-exists with a new one (PHP 7.x)