How to switch to a different PHP version?


For some reason this still eludes me when I need it. So I decided to save this information on my own site.

Go to cPanel, File Manager and choose “Web Root (public_html/www)”. There create a new file (or edit the existing one) called .htaccess and add the following line:

To switch to PHP 7.0

1    AddHandler application/x-httpd-php70 .php .php5 .php4 .php3

To switch to PHP 5.6

1    AddHandler application/x-httpd-php56 .php .php5 .php4 .php3

To switch to PHP 5.5

1    AddHandler application/x-httpd-php55 .php .php5 .php4 .php3

To switch to PHP 5.4

1    AddHandler application/x-httpd-php54 .php .php5 .php4 .php3

To switch to PHP 5.3

1    AddHandler application/x-httpd-php53 .php .php5 .php4 .php3