Menu Close

How to switch to a different PHP version?


So if you are wanting to upgrade the PHP version of your website, you have come to the right place.

This can usually be performed through your web hosting control panel (cPanel/Plesk), but for whatever reason, you don’t have access to this, you can actually update it via the .htaccess file.

Before proceeding, back up your .htaccess file or your entire website, just to be extra safe!

Also, if you’re doing this to permanently upgrade the PHP version of your WordPress website, find out if your web host, theme, and plugins support a higher version of PHP, such as 7+.

So the .htaccess file can be found in the root of your public domain, I’ll give you several handlers to add, but you should stick to PHP 7+ (7.3 currently recommended) because it’s faster and more secure!

So to perform the upgrade, add one of the below handlers right above the #BEGIN WordPress line in your .htaccess file:-

Change to PHP 7.3

AddHandler application/x-httpd-php73 .php

Change to PHP 7.2

AddHandler application/x-httpd-php72 .php

Change to PHP 7.1

AddHandler application/x-httpd-php71 .php

Change to PHP 7.0

AddHandler application/x-httpd-php70 .php

Change to PHP 5.6

AddHandler application/x-httpd-php56 .php

Change to PHP 5.5

AddHandler application/x-httpd-php55 .php
View Source
Posted in PHP