How to Safely Change PHP Version in WordPress: A Step-by-Step Guide
Bulletproof Backups for Your WordPress Website
Fortify your business continuity with foolproof WordPress backups. No data loss, no downtime — just secure, seamless operation.
Are you facing issues with your WordPress site, like plugin errors or problems during site migrations? You’re not alone. Many WordPress site owners encounter these challenges due to an outdated or incompatible PHP version.
An outdated or incompatible PHP version can cause plugin and theme errors, break custom code, and disrupt your site’s functionality. These issues can be frustrating and negatively impact user experience.
But there’s an easy solution: change your PHP version! This guide will show you how to do that safely. By doing so, you’ll ensure better compatibility, fewer errors, and a more smoothly running site.
TL;DR: You can change your PHP version via your hosting panel or cPanel, but be aware of potential risks like compatibility issues. Always take a complete backup of your site using a reliable plugin like BlogVault to ensure you can restore everything if needed.
Understanding PHP versions
PHP is the coding language that powers your WordPress site behind the scenes and is integral to your site’s setup. Unlike updating WordPress or plugins, changing your PHP version involves modifying settings on your server. This is because the PHP version refers to your server’s configuration.
PHP handles vital tasks like managing your site’s database and ensuring everything runs smoothly on the server side. It can be seamlessly integrated with HTML, making it easy to create interactive web pages.
Each new PHP version offers better performance and enhanced security, so keeping it updated is essential. However, you can’t update PHP directly from the WordPress dashboard.
You’ll need permission or tools from your hosting provider, as it is their server and they control the settings—unless the website is self-hosted.
Steps to take before changing the PHP version
Changing your PHP version, whether upgrading or downgrading, can improve your site’s performance and security, but it also poses some risks. To ensure everything goes smoothly, follow these steps:
1. Create a full backup: Take a full backup of your entire site using a plugin like BlogVault. This way, you can restore your site if something goes wrong.
2. Verify your current PHP version: Check which PHP version your site is using. You can do this within the BlogVault dashboard or by navigating to Tools > Site Health > Info > Server in your WordPress admin area. You can also do this via your hosting control panel.
3. Check compatibility: Make sure your plugins and themes work with the new PHP version you plan to use. You can create a staging site using BlogVault to test it. Alternatively, developers usually list the compatibility information on the plugin or theme’s page, so make sure to review it. This helps avoid issues after the upgrade.
4. Clear your site’s cache: Clear your site’s cache to make sure all changes take effect properly. This includes clearing the caches of browsers, caching plugins, and any other software that may cache the site.
How to change PHP version in WordPress via hosting control panel
You can change your WordPress PHP version using your web host’s control panel. We’ll use Cloudways as an example. While different hosting providers have different interfaces, the steps are generally the same. Here’s how to go about it:
1. Access your web host’s control panel: Log into your Cloudways account and navigate to the Servers section in the top menu. Select the server where your WordPress site is hosted.
2. Find your PHP settings: In the server management dashboard, go to the Settings & Packages tab. Within this section, locate the Packages tab and find the PHP version settings.
3. Select and apply PHP version: Click on the Modify button and with the dropdown menu, choose the PHP version you want to upgrade or downgrade to.
4. Test your website: Check your website to ensure it is functioning correctly. Thoroughly test key parts such as plugins and themes to make sure everything works seamlessly and monitor for any errors or performance issues.
Note:If you’re experiencing timeout issues during these changes, it may be necessary to change the PHP time limit in WordPress to avoid script interruptions.
How to change PHP version via cPanel
Another way to change your PHP version is through cPanel. Several hosts use cPanel as their hosting management tool. Even if they don’t, Plesk and Webmin will have similar tools, and the process is largely the same. Here’s how you can go about it:
1. Navigate to MultiPHP manager: Log into your cPanel dashboard and scroll down to the Software section. Find and click on MultiPHP Manager.
2. Select your domain: In the MultiPHP Manager, you will see a list of your domains. Use the checkboxes to select the domain(s) for which you want to change the PHP version.
3. Choose PHP version: In the PHP version dropdown menu, select the PHP version you want to upgrade or even downgrade to from the available options.In some cases, you might find it necessary to downgrade the PHP version in WordPress if the newer version causes compatibility issues with plugins or themes.
4. Test your website: Thoroughly test your website to ensure everything functions correctly. Also, check critical functionalities, including plugins and themes, for any issues.
Importance of keeping PHP updated
Keeping your PHP version updated is crucial for several reasons. It ensures better performance and also improves security. PHP updates address vulnerabilities, introduce new coding methods, features, and enhancements that can significantly benefit your website.
By staying current with PHP updates, you protect your site from potential hackers and threats, as newer versions include patches for known security issues. This keeps your data and your visitors’ information safe.
Lastly, it is essential to ensure that all your themes and plugins are compatible with the latest PHP version before updating. Incompatible plugins or themes may cause errors or crashes, so always check for compatibility updates or alternatives to avoid issues.
Common issues with outdated PHP versions
If you don’t keep PHP updated, you might run into issues, like:
- Slow site performance: An outdated PHP version can make your site slow, which frustrates visitors and can drive them away.
- Increased security vulnerabilities: Older versions of PHP are more susceptible to attacks, putting your site at risk for data breaches.
- Incompatible plugins and themes: Outdated PHP can cause plugins and themes to malfunction or not work at all, leading to various functionality issues.
Pros and cons of changing PHP version
Changing your PHP version can have a significant impact on your WordPress site, both positively and negatively. Here’s a quick look at the pros and cons to help you make an informed decision.
Pros
- Better performance
- Enhanced security
- Improved compatibility
- New features
Cons
- Compatibility issues
- Adjustment period
- Possible downtime
Note: While upgrading your PHP version offers numerous benefits, it’s important to be aware of the potential for compatibility issues and downtime. In such cases, a PHP version downgrade may be necessary.
Troubleshooting issues that arise with changing your PHP version
Switching to a new PHP version can sometimes cause problems on your WordPress site. Here are some common issues and how to troubleshoot them:
Plugin incompatibility
Try deactivating and reactivating the affected plugins or themes. Alternatively, contact the customer service to see how they can help with your compatibility issues.
Theme errors
Similar to the plugin incompatibility fix, use an alternate theme if you can or download and upload an older version of the theme.
Fatal errors
Examine the error logs to find the source of the fatal error. Log in to your web hosting control panel, navigate to the File Manager, and look for an error_log file in your public_html directory.
Error entries usually have labels like Fatal error, Warning, or Error along with details pointing to a specific file, line number, or plugin causing the issue. If the error cannot be quickly resolved, revert to the previous PHP version.
White screen of death
To fix the white screen if death, enable WordPress debugging by editing your wp-config.php and adding the lines:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);
Check the debug.log in wp-content for errors. Next, deactivate plugins by renaming the plugins folder in wp-content, and switch themes by renaming your current theme’s folder in wp-content/themes to isolate the problem.
500 internal server error
To fix the 500 internal server error, check your .htaccess file for misconfigurations or increase the PHP memory limit in your wp-config.php file.
You can do the latter by adding:
define('WP_MEMORY_LIMIT', 'xM');
anywhere before the line that says, That’s all! Stop editing. Happy blogging!
Make sure you replace x with a higher value than the existing one.
Missing files or permissions errors
Ensure all files have correct permissions and are properly uploaded. Check with your hosting provider for more help with the missing files.
Deprecated functions or features
Check error logs within your error_log file for deprecated functions that need replacing.
Look for lines that include the term “deprecated” followed by the function name, file path, and line number. Example: PHP Deprecated: Function create_function() is deprecated in /path/to/your/file.php on line 123
Update your code by consulting a professional or the official PHP documentation for alternative functions or features.
Slow performance after change
Clear all caches (browser, site, and server). Ensure no unnecessary plugins or scripts are slowing down the site.
Custom code not working
If your custom code stops working, check for any functions or coding practices that are deprecated in the new PHP version. They often appear in the error log files as warnings. Update your custom code to align with the latest PHP standards.
Parting thoughts
Keeping your WordPress site running smoothly and securely includes using the right PHP version. This helps your site perform at its best and stay protected from security threats.
Before making any changes, ensure you backup your website. Next, check for compatibility with your themes and plugins, and have a rollback plan in place. With BlogVault, you can rollback a specific plugin or a theme. These steps will help ensure a smooth transition.
If you run into any problems, don’t hesitate to reach out to your hosting provider’s support team.
FAQs
How do I change my PHP version in WordPress?
Changing your PHP version usually involves accessing your hosting panel or cPanel and selecting the desired PHP version from the available options. You will have to look for PHP settings or a PHP manager, and then choose the version you want to switch to.
Is it safe to change the PHP version in WordPress?
Yes, it is safe as long as you follow preparatory steps such as backing up your site and checking compatibility with your themes and plugins. This way, you can ensure that everything will continue to work correctly with the new PHP version without any disruptions or issues.
How can I verify my website’s PHP version?
You can check your PHP version from your WordPress dashboard by navigating to Tools > Site Health > Info > Server. You can also verify it through your hosting control panel. Both methods will give you the current PHP version your site is running.
Can you revert a PHP version?
Yes. If you encounter issues with a new PHP version, you can revert to the previous version using your hosting panel or cPanel. Simply go back to the PHP settings and select the earlier version that was working fine, then save and apply the changes to revert to the earlier version.
Can I change my PHP version?
Yes, you can change your PHP version through your hosting provider’s control panel or cPanel. Always follow necessary precautions like backing up your site and checking for compatibility to ensure a smooth transition.
Tags:
Share it:
You may also like
WordPress Update Failed? Here’s Your Step-by-Step Solution
You’re in the middle of updating your WordPress site when, all of a sudden, the screen shows that dreaded message: “Update Failed.” This can leave you scratching your head, wondering…
Multiple Staging Sites in BlogVault: Streamline Website Management with Parallel Testing
Staging sites are the practice arenas for your WordPress sites. They allow you to test changes, try out new features, and fix issues. All this, without disturbing your live website. Think…
8 Ways To Fix WordPress Fatal Error
Encountering this WordPress error can definitely be stressful. The term ‘fatal’ suggests serious problems, even potential data loss. But take a deep breath—your site is neither dying nor beyond repair….
How do you update and backup your website?
Creating Backup and Updating website can be time consuming and error-prone. BlogVault will save you hours everyday while providing you complete peace of mind.
Updating Everything Manually?
But it’s too time consuming, complicated and stops you from achieving your full potential. You don’t want to put your business at risk with inefficient management.
Backup Your WordPress Site
Install the plugin on your website, let it sync and you’re done. Get automated, scheduled backups for your critical site data, and make sure your website never experiences downtime again.