At some point, you might need to change the PHP version of your WordPress website, especially if you’re running on an old version.
Our Top Ranked #1 Web Host for WordPress Hosting
Latest Uptime Stats (Real Records):
Server Response Speed Test Scored A+:
So, in this tutorial, I’ll show you how to do that using .htaccess, which is a configuration file for servers that run on the Apache software.
Change the PHP version of your WordPress site using .htaccess
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+.
Step 1 – Access your site’s files
The .htaccess file should normally be in your WordPress website’s root folder –
Step 2 – Edit the .htaccess file
Open the .htaccess file for editing.
If you’re in cPanel, right-click on it and select Edit or Code Edit.
Step 3 – Add the code and save the file
I’ll give you several handlers to add, but you should stick to PHP 7+ (7.2 currently recommended) because it’s faster and more secure!
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
That’s a wrap
Hope you found the tutorial useful and managed to change the PHP version of your WordPress website using .htaccess!
Don’t forget to share the post to help out others!
You can quickly subscribe to my newsletter by using this link.
If you have any questions or thoughts, drop a comment or send a message via contact or Facebook page.
My WordPress website or blog services are at your disposal!