Override PHP Version

Overriding Default PHP Version

The default PHP version used is 8.0. It is possible to override the system default PHP version for a particular directory or file extension using by adding this at the beginning of an .htaccess file:

AddHandler application/x-httpd-suphp80 php #For PHP 8.0
AddHandler application/x-httpd-suphp74 php #For PHP 7.4
AddHandler application/x-httpd-suphp73 php #For PHP 7.3
AddHandler application/x-httpd-suphp72 php #For PHP 7.2
AddHandler application/x-httpd-suphp71 php #For PHP 7.1
AddHandler application/x-httpd-suphp70 php #For PHP 7.0
AddHandler application/x-httpd-suphp56 php #For PHP 5.6

This will change the version of PHP for the directory in which the .htaccess exists and all directories below it unless overridden by a lower level .htaccess in a daughter directory.

It is also possible to set a different version of PHP based upon the file extension thusly:

AddHandler application/x-httpd-suphp73 php #Use 7.3 for files ending in "php".
AddHandler application/x-httpd-suphp56 ph5 #Use 5.6 for files ending in "ph5".