Using multiple PHP versions on one account

Below is an example of having multiple directory locations using different versions on PHP. The following example shows the "public_html" is using PHP 5.4, the "public_html/othersite" using PHP 5.2 and so forth.

public_html 5.4
public_html/othersite: 5.2
public_html/someothersite: 5.3
public_html/someothersite/yetanother: 5.4

Now, for example if you want to use PHP 5.2 at /othersite, paste below code in your .htaccess file.

# Use PHP 5.2 as default
AddHandler application/x-httpd-php52 .php
Copyright © 2023 Siam Naulak.