# PHP versions on hosting: which to use and how to upgrade safely

> Why the PHP version matters, how PHP's support cycle works, how to check and change the version on hosting and what to do when a plugin breaks.

Source: https://comparehostingonline.com/guides/php-versions-on-hosting/

## Short answer

Use a PHP version that still receives security fixes, and update to it in your hosting panel after testing on a staging copy. Old versions are slower and are no longer patched, so they put your site at risk.

Last verified Nov 28, 2026 · [How we test](https://comparehostingonline.com/methodology/)

At a glance

-   **Why does the PHP version matter?** PHP is the language WordPress, Laravel and thousands of other applications run on.
-   **How long is each PHP version supported?** According to the PHP project's supported versions page, each release branch is fully supported for two years from its initial…
-   **Which version should you use?** The newest version your software officially supports, if it is within active support.

## Why does the PHP version matter?

PHP is the language WordPress, Laravel and thousands of other applications run on. Your host chooses which versions are installed, and you usually choose which one your site uses. The version affects three things: security, because unsupported versions no longer get fixes; speed, because newer versions are generally faster; and compatibility, because current themes, plugins and frameworks require recent versions and drop support for old ones.

## How long is each PHP version supported?

According to the PHP project’s supported versions page, each release branch is fully supported for two years from its initial stable release, during which bugs and security issues are fixed in regular releases. After that, each branch gets security fixes only for two more years. When that ends, the version is unsupported and receives no fixes at all. The page lists the exact dates for every branch, and you should check it rather than rely on a number remembered from an old article.

In practice that means a version is a reasonable choice while it is within active or security support, and you should be planning the next upgrade a year before it ends.

## Which version should you use?

-   The newest version your software officially supports, if it is within active support.
-   At least a version that is still in the security-fix period.
-   Never a version that has reached end of life, even if your host still offers it.
-   The version recommended by the application: WordPress publishes its recommended PHP version on its requirements page.

## How do you change the PHP version on hosting?

In cPanel the tool is often called MultiPHP Manager or Select PHP Version. Other panels have a similar page. On a VPS you install the version yourself and point the web server at it.

1.  1
    
    **Check compatibility**
    
    Read plugin and theme notes, and run a compatibility checker if one exists.
    
2.  2
    
    **Back up**
    
    Files and database; see website backups.
    
3.  3
    
    **Test on staging**
    
    Switch the staging copy and click through the site; see what a staging site is.
    
4.  4
    
    **Change it live**
    
    Use the PHP selector in your panel, then read the error log.
    

## What if the upgrade breaks something?

Switch back to the previous version to restore the site, then find the cause. Turn on error logging and look at the log to see which file and line failed. Usually it is a plugin or theme that uses a feature removed in the newer version. Update it, replace it or ask its developer. For custom code, read the PHP migration guides, which list removed and deprecated features for each version. Keep the old version only as a short-term bridge.

## How does PHP version affect performance?

Each major release has improved the speed of the engine, and a modern version can run a typical application noticeably faster than one a few years older, with less memory use. Combine it with OPcache, which keeps compiled code in memory, and page and object caching. Our guides on [what TTFB is](https://comparehostingonline.com/guides/what-is-time-to-first-byte/) and [Redis object caching](https://comparehostingonline.com/guides/what-is-redis-object-caching/) show how these fit together.

## What should you ask a host about PHP?

-   Which versions are available now, and when do you remove old ones?
-   Can I choose a version per site or per folder?
-   Is OPcache enabled and are the usual extensions installed?
-   Can I change PHP settings such as memory limit and upload size?
-   How are security fixes applied?

Our [provider pages](https://comparehostingonline.com/providers/) list what each provider states, and [how to test a host’s support](https://comparehostingonline.com/guides/test-hosting-support-before-buying/) shows how to ask.

## What are the common mistakes?

-   Running an end-of-life version because “it works”.
-   Upgrading on the live site without a backup or staging test.
-   Ignoring warnings and deprecation notices until they become errors.
-   Choosing a host that cannot offer current versions.

## A worked example: upgrading across two PHP versions

A site runs on a PHP version that reached the end of security support a year ago. The owner wants to jump to a current supported version. They read the changelogs of each plugin and theme, update everything on staging first and switch staging to the newer PHP. Two warnings appear: a plugin uses a deprecated function and an old contact-form add-on fails. They replace the add-on with a maintained one and update the other plugin. After a clean test, they back up the live site, switch live PHP and watch the error log for a day.

The upgrade needed an evening of work and removed a security risk. Waiting another year would have made it harder, because more plugins would have dropped support for the old version.

## What are the most common PHP errors after an upgrade?

-   A fatal error about an undefined function: a plugin uses something removed.
-   A deprecation notice: not breaking yet, but a warning that code will fail in a later version.
-   A white screen: turn on error logging and read the log.
-   Memory errors: raise the memory limit if the new version uses more with your code.
-   Missing extensions: enable them in the PHP selector.

## Which PHP extensions and settings matter?

Change these in the control panel’s PHP settings page or in a configuration file where the host allows it. Keep changes modest and document them.

| Setting or extension | Why it matters |
| --- | --- |
| OPcache | Keeps compiled PHP in memory; a large speed gain |
| memory\_limit | Maximum memory per PHP process; too low causes fatal errors with heavy plugins |
| max\_execution\_time | How long a script may run; imports and backups may need more |
| upload\_max\_filesize and post\_max\_size | Limits for media and form uploads |
| Common extensions (mysqli, curl, mbstring, gd or imagick, intl, zip) | Required by many plugins and frameworks |
| max\_input\_vars | Limits form fields; large menus and builders can hit it |

## What is the difference between PHP-FPM and older handlers?

Older setups run PHP as a module of the web server or through CGI, which is simple but less efficient. PHP-FPM runs a separate pool of PHP worker processes managed independently of the web server. It is faster, gives better isolation between accounts and lets you tune the number of workers. Many modern hosts use it by default. The number of workers limits how many PHP requests run at once, which is why heavy checkout pages can slow down under load; see our [ecommerce hosting checklist](https://comparehostingonline.com/guides/ecommerce-hosting-checklist/) and [how to choose a VPS size](https://comparehostingonline.com/guides/how-to-choose-a-vps-size/).

## How do you check which PHP version a site uses?

In WordPress, open Tools then Site Health and then the Info tab, which lists the PHP version and extensions. In a control panel, the PHP selector shows the version for each site. On a server with SSH you can run the PHP command-line tool with its version flag, though the command-line version can differ from the one the web server uses, so confirm in the panel or with a test page. Check after every host change, because a migration can silently drop you onto a different version.

## Sources and further reading

-   [PHP: supported versions](https://www.php.net/supported-versions.php)
-   [WordPress: requirements](https://wordpress.org/about/requirements/)
-   [Laravel documentation: deployment](https://laravel.com/docs/deployment)

## Common questions

Which PHP version should I use?

Use a version that still receives security fixes and that your themes and plugins support, ideally the newest supported one. The PHP project's supported versions page lists current branches and their end-of-life dates.

How long does PHP support a version?

Each release branch gets two years of full support and then two more years of security fixes only. After that it is unsupported and receives no fixes at all, so plan upgrades before that date.

Can changing the PHP version break my site?

Yes, if a plugin, theme or custom code uses features removed in the newer version. Back up, test on staging first, read the error log and roll back to the previous version if something fails.

Where do I change the PHP version?

In your hosting panel, often in a PHP selector such as MultiPHP Manager in cPanel. On a VPS you install the version and configure the web server yourself. Some hosts allow a version per site.

Does a newer PHP make my site faster?

Often yes. Newer versions generally run faster and use less memory. The gain depends on your code and plugins, so combine the upgrade with caching and measure before and after.

## Related

[WordPress hosting requirements](https://comparehostingonline.com/guides/wordpress-hosting-requirements/) [Hosting for PHP and Laravel](https://comparehostingonline.com/hosting-for/php-laravel/) [What is a staging site?](https://comparehostingonline.com/guides/what-is-a-staging-site/)

## More guides

[Shared hosting vs managed WordPress hosting: which do you need?](https://comparehostingonline.com/guides/shared-vs-managed-wordpress-hosting/) [Subdomain vs subfolder: which is better for your site?](https://comparehostingonline.com/guides/subdomain-vs-subfolder/) [How to test a host's support before you buy](https://comparehostingonline.com/guides/test-hosting-support-before-buying/) [How to transfer a domain name to a new registrar](https://comparehostingonline.com/guides/transfer-a-domain-name/) [Website migration checklist: move to a new host with little or no downtime](https://comparehostingonline.com/guides/website-migration-checklist/) [What are inodes in web hosting? Limits, causes and how to reduce them](https://comparehostingonline.com/guides/what-are-inodes-in-hosting/)

MH

**[Muhammad Hamza](https://comparehostingonline.com/team/muhammad-hamza/)** Founder & Editor

Writes and signs off every comparison, and runs the compliance reviews. Has worked on SOC 2 and HIPAA compliance programs for companies.

Our [editorial policy](https://comparehostingonline.com/editorial-policy/) and [testing method](https://comparehostingonline.com/methodology/) are public.
