CompareHostingOnline

Home / Guides / PHP versions on hosting: which to use and how to upgrade safely

Guide

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.

By Muhammad Hamza, Founder & EditorUpdated Nov 30, 2026

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
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. Check compatibility

    Read plugin and theme notes, and run a compatibility checker if one exists.

  2. Back up

    Files and database; see website backups.

  3. Test on staging

    Switch the staging copy and click through the site; see what a staging site is.

  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 and 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 list what each provider states, and how to test a host’s support 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 extensionWhy it matters
OPcacheKeeps compiled PHP in memory; a large speed gain
memory_limitMaximum memory per PHP process; too low causes fatal errors with heavy plugins
max_execution_timeHow long a script may run; imports and backups may need more
upload_max_filesize and post_max_sizeLimits for media and form uploads
Common extensions (mysqli, curl, mbstring, gd or imagick, intl, zip)Required by many plugins and frameworks
max_input_varsLimits 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 and 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

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

More guides

Esc

Use the arrow keys, then Enter.