We can update the PHP version by using the htaccess file easily. Nowadays, many hosting providers provide the ability to change the version in a single click, but sometimes we need to update the PHP version by editing the htaccess file.
How to update php version using htaccess
For changing the PHP version, add the following code to the htaccess file.
# php -- BEGIN cPanel-generated handler, do not edit # Set the “ea-php74” package as the default “PHP” programming language. <IfModule mime_module> AddHandler application/x-httpd-ea-php74 .php .php7 .phtml </IfModule> # php -- END cPanel-generated handler, do not edit
Above code will update the php version to the PHP 7.4, You can edit the version ID in above code as per your requirements.