Here’s how to update PHP in WordPress safely: check which PHP version your site runs, confirm your theme and plugins support the newer version, take a full backup, test the switch on a staging copy, then change the PHP version in your hosting control panel and check the live site straight away. PHP is not updated from inside WordPress; it’s a setting on your server, so the switch happens at your host.
Running an outdated PHP version is one of the most common reasons WordPress sites end up slow or exposed to security issues. The good news is that the update itself usually takes a few minutes. The preparation is what keeps it from breaking your site.
Why knowing how to update PHP in WordPress matters
PHP is the programming language WordPress is written in. Your server runs a specific PHP version, and each version eventually stops receiving security fixes. When that happens, any newly discovered vulnerability in it stays unpatched.
Newer PHP versions also tend to run WordPress code more efficiently and give plugin developers modern features. Many plugins and themes eventually drop support for old versions, which means staying behind can block you from installing updates. The current recommended versions are listed on the WordPress.org requirements page; check it rather than relying on a number in a blog post, because the recommendation moves over time.
Step 1: Find your current PHP version
You can check this inside WordPress without touching the server:
- In your WordPress dashboard, go to Tools > Site Health.
- Open the Info tab.
- Expand the Server section and look for the PHP version.
The Site Health Status tab may also show a warning if your PHP version is outdated. Your hosting control panel will show the same information, usually in a section called PHP settings, PHP version or similar.
Write down the current version. You’ll need it if you have to roll back.
Step 2: Check theme and plugin compatibility
Most compatibility problems come from old or abandoned plugins and custom code, not WordPress core. Before you switch:
- Update everything first. Update WordPress core, your theme and all plugins to their latest versions. Developers usually fix PHP compatibility issues in recent releases.
- Check each plugin’s page on WordPress.org. Look at when it was last updated and whether the developer mentions PHP requirements. A plugin that hasn’t been updated in a long time is a red flag.
- Ask premium plugin and theme vendors. Their changelogs or support docs usually state which PHP versions they support.
- Review custom code. If a developer added code to your theme’s functions.php or a custom plugin, it may use functions that newer PHP versions have removed. Ask them to check, or test it on staging.
- Remove what you don’t use. Deactivate and delete inactive plugins and themes. Less code means fewer chances of a conflict.
Developers can go further with a PHP compatibility scanner such as the PHPCompatibility ruleset for PHP_CodeSniffer, which flags code that won’t run on a target version.
Step 3: Back up the whole site
Never change the PHP version without a fresh backup of both the database and files. If something goes wrong, the fastest fix is often to switch PHP back, but a backup protects you if an update or a failed plugin migration has already changed data. Our guide on how to back up a WordPress site covers what to include and where to store it.
Step 4: Test on a staging site
A staging site is a private copy of your live site where you can test changes safely. Many hosts offer one-click staging; otherwise you can clone the site to a subdomain or a local environment.
On staging:
- Switch the PHP version to your target.
- Turn on debug logging by adding these lines to wp-config.php (above the line that says “That’s all, stop editing!”):
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
- Click through the site: home page, key landing pages, blog posts, forms, search, the cart and checkout if you have a store, and the WordPress admin.
- Check the log at wp-content/debug.log for fatal errors and warnings that point to a specific plugin or theme file.
- Fix or replace anything that breaks, then test again.
Step 5: Change the PHP version at your host
How to update PHP in WordPress depends on your host, because the setting lives in their control panel. Common places to look:
- cPanel: a tool usually named MultiPHP Manager or Select PHP Version, where you pick the version per domain.
- Plesk: the PHP settings for the domain, under Websites & Domains.
- Custom hosting dashboards: a PHP or server settings section for each site.
- Managed hosts with no visible option: open a support ticket and ask them to switch the version, or ask whether they schedule PHP upgrades for you.
If you manage your own server, updating PHP means installing the new PHP packages and extensions, pointing your web server (for example, PHP-FPM with Nginx) at the new version and reloading services. Only do this if you’re comfortable managing a server and have a rollback plan.
Pick a quiet time, such as outside business hours, to make the switch on your live site.
Step 6: Check the live site and watch the logs
Right after the switch:
- Load the home page and a few key pages in a private browser window.
- Log in to the dashboard and confirm Site Health shows the new PHP version.
- Submit a test form and, for stores, place a test order.
- Clear any page cache and CDN cache so visitors get freshly generated pages.
- Check your server’s PHP error log and the WordPress debug log over the next day or two. Some errors only appear on specific pages or scheduled tasks.
On our own site we once found an XML sitemap page returning a server error because PHP ran out of memory building one very large sitemap. Problems like that only show up in logs and specific URLs, which is why checking a few unusual pages matters, not just the home page.
What to do if your site breaks
If you see a blank page or “There has been a critical error on this website”, don’t panic:
- Switch PHP back to the previous version in your hosting panel. This fixes most issues immediately.
- Check your admin email. WordPress can send an email with a recovery mode link that lets you log in and deactivate the plugin or theme causing the error.
- Read the error log to find the file responsible, then update, replace or remove that plugin or theme.
- Restore from backup if data was changed or files were damaged.
Once you’ve fixed the cause on staging, try the upgrade again.
Keep PHP current going forward
Updating PHP isn’t a one-time job. Set a reminder to check your version a few times a year, keep plugins updated so they stay compatible, and remove plugins whose developers have stopped maintaining them. Staying current is also part of good security hygiene; our guide to securing a WordPress website covers the other habits that go with it.
If you’d rather not handle PHP upgrades, testing and rollbacks yourself, our WordPress care plans include managed updates, backups and monitoring, so changes like this are planned and tested for you.
FAQ
Can I update PHP from the WordPress dashboard?
No. PHP runs on your server, so you change the version in your hosting control panel or ask your host to do it. WordPress only shows you which version you are running, in Tools > Site Health > Info > Server.
Will updating PHP break my WordPress site?
It can if a plugin, theme or custom code isn’t compatible with the newer version. Updating everything first, testing on a staging site and keeping a backup make problems rare and easy to undo.
Which PHP version should my WordPress site use?
Use a version that is still supported with security fixes and that WordPress recommends. Check the current recommendation on the WordPress.org requirements page, since it changes over time.
How do I roll back a PHP update?
Switch back to the previous PHP version in your hosting control panel. If the update changed data or files, restore your most recent backup, then fix the incompatible plugin or theme before trying again.


