How to Use Different PHP Versions for Different Websites

Let's say that you currently set your default PHP version on cPanel › Select PHP Version to 8.3. This PHP version applies to all of your websites (domains, subdomains, and all directories). But you want to use PHP version 7.4 only on a specific website.

To do this, create an .htaccess file with the following code in the directory of this website:

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
	SetHandler application/x-httpd-alt-php74___lsphp
</FilesMatch>

This specific website now uses PHP version 7.4, while the rest of your websites still uses 8.3.

If you want to use a different PHP version, simply change the bolded text to the version that you want. You can refer to cPanel › Select PHP Version for the available PHP versions.