Notes: Change PHP Version using .htaccess

February 25, 2021

This is normally useful if you want a different PHP Version per folder.

Use PHP Version 7.4

AddHandler application/x-httpd-ea-php74 .php
<IfModule mod_suphp.c>
    suPHP_ConfigPath /opt/php73/lib
</IfModule>

This is the only code I used though on one of my installations. The application on the root folder or live environment only needs PHP 5.3 and I created a staging environment using WordPress that needs a newer version of PHP and the PHP Manager in cPanel doesn’t have an option to use a different PHP version per folder.

AddHandler application/x-httpd-ea-php74 .php

You can change the PHP version by changing 74 to your preferred version, example: 73 for version7.3, 72 for version 7.2, etc.

Please take note that the server should support the preferred version for this to work.

Get In Touch

Email: [email protected]


CAPTCHA image

This helps us prevent spam, thank you.



Categories