Using both php4 and php5 at the same time in Directadmin

If you wish to use both php4 and php5 at the same time, custombuild will allow you to do this.
Note that you must have the 2 copies of php running as different types, one as CLI and one as CGI (suPhp). You cannot have both running as CLI, and similarly you cannot have both running as CGI.

First, make sure you’re running custombuild.
This is the guide to install it if you don’t have it:

To setup both php4 and php5, you’ll be editing the options.conf, eg:

cd /usr/local/directadmin/custombuild

nano options.conf

The php section of the options.conf should be changed to look like (Assumin php4 with cli, and php5 with cgi)

#PHP settings. default_php possible values – 4 or 5

Save/exit the options.conf.
Note that the default_php version (4 or 5) refers to what version of php files with extension .php will use. You can also use .php5 and .php4 extensions to be explicit with which you want.

Once saved, you’ll need to compile both phps, then rewrite apache configs.

Note that when you convert to CGI (suPhp) from CLI.. it will be much more strict with it’s rules about permissions and owernship. If you get any “internal server errors”, 500, etc… check the /var/log/httpd/suphp.log to see why, as well as /var/log/httpd/domains/ and Ensure your files are chowned to your user (not root, or apache) and chmod to no more than 755. With suPhp, you can run php files as chmod 700 for improved security.


To use php4 for any domain, just write below line in your .htaccess of that domain

And that domain will start using php4

Please follow and like us:
About shk

shk is a DevOps engineer with more than 12 years of experience in different organizations. He enthusiastic about learning new technologies and shares his knowledge through his blogs.

Comment Policy:

Your words are your own, so be nice and helpful if you can. Please, only use your real name, not your business name or keywords. Using business name or keywords instead of your real name will lead to the comment being deleted. Anonymous commenting is not allowed either. Limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.

Tell us what you're thinking...

All comments are moderated.

* Denotes required field.



Previous Post:
Next Post: