Equally a WordPress administrator, updates are fundamental to your job. For optimal functionality and strong security, y'all demand to ensure that your theme, plugins, and WordPress cadre are running their latest versions.

On top of this, nosotros also recommend updating your PHP.

But hold on...what is PHP? The term might sound familiar to you — that'southward because your site, and all WordPress websites, run on it. Every bit part of WordPress' underlying lawmaking backbone, PHP works with HTML, CSS, and JavaScript to create the framework of WordPress sites worldwide.

In this mail, I'll cover what you need to know nigh the PHP language, how it generates content in WordPress, why it needs to exist updated, and how to upgrade your WordPress site to the latest version of PHP.

Grow Your Business With HubSpot's Tools for WordPress Websites

What is PHP?

PHP is a programming language frequently used on the web. First released in 1995 equally a general-purpose programming language, PHP has become a favorite tool among developers for enabling dynamic web pages. Dynamic web pages are those which are generated by the hosting server when requested past a customer, rather than stored on the server in their entirety.

PHP is a server-side linguistic communication, which means information technology runs entirely on the server that hosts the website. This distinguishes it from other languages you might know, including HTML, CSS, and JavaScript. These are client-side languages — they run on the device of the company accessing a website (i.e., the company's web browser).

So, what exactly does PHP do on the web server? In curt, PHP lawmaking is what generates the dynamic HTML pages to be sent to the client. When a site visitor requests a spider web page with a URL, a special PHP module on the server processes the asking, so executes PHP code to create an HTML folio from scratch. Lastly, the server delivers a complete HTML file back to the visitor'southward web browser.

What does PHP practise in WordPress?

Rather than shop each website page separately equally individual HTML files, WordPress contains many PHP files that each control a different part of your page, such as headers and footers, annotate sections, etc. If y'all look at your WordPress file names, yous'll detect these files terminate with a ".php" extension.

On your WordPress site, the master task of PHP is to fetch page content stored in your WordPress database and plow it into web pages. Upon receiving a request for a page, the PHP lawmaking pulls relevant page content from your WordPress database, converts it into an HTML file (and accompanying CSS files), and sends the HTML back to the company who made the request.

Why assemble pages this manner? In a discussion, flexibility. In conjunction with HTML and CSS, PHP makes information technology possible for developers to create themes and must-have WordPress plugins that run on their own PHP files. These themes and plugins can use WordPress database content however they like. If you want to swap plugins and/or themes, this setup besides lets you lot practice so without the need to generate a new set of pages every time. Every page on your site is generated in real-time when requested.

Additionally, PHP is a proficient fit for WordPress because, like WordPress itself, PHP is open-source. Anyone can run across how the linguistic communication works nether the hood and customize information technology for their site if desired.

PHP and the CMS Revolution

While PHP enjoyed some popularity in the web evolution customs for years, the appearance of Content Management Systems (CMS) really put this language on the map. WordPress is the most popular CMS on the net, and this fact is a attestation to the robustness and versatility of PHP.

What is PHP 7?

PHP 7 is the latest version of PHP, released in belatedly 2015. WordPress played a primal role in shaping this version — during its evolution, the WordPress community examined and tested every chemical element to ensure compatibility with the CMS.

Today, more xviii% of WordPress sites use PHP vii, with many plugins and themes actively supporting this version. PHP upgrades are ongoing, and PHP viii will be released in late 2020.

PHP 7 is a major upgrade from the previous version, PHP 5.half-dozen. (If you're wondering what happened to PHP 6, the projection was scrapped due to technical issues and poor reception.) Notable improvements in PHP vii include:

  • Increased speed: PHP vii uses less memory to accomplish the same goal, providing a substantial performance boost.
  • Enhanced declarations: The addition of Scalar Type and Return Type declarations makes code easier to read and customize.
  • Improved error handling: Previous PHP versions handled fatal errors by halting the unabridged code script. PHP 7 lets the script continue to run and throws an mistake instead.

Why You Should Upgrade Your PHP in WordPress

WordPress and many WordPress hosts make updates piece of cake with automation. Even so, manual updates can be a hassle. Is upgrading PHP really worth your fourth dimension?

Absolutely. The benefits of the latest PHP can exist boiled down to three factors: speed, security, and compatibility.

Increased Speed

Between releases, PHP developers update the linguistic communication to utilize resources more efficiently and introduce new features and functions. This means that each new release of PHP will run your WordPress website faster than earlier. Non only volition better performance keep visitors engaged with your site — it can as well boost your rankings in search engines.

To evaluate PHP 7 functioning, nosotros tested PHP 7 on WordPress in a strictly controlled environment. The server was striking 37,378 times with zero errors and zero timeouts. The average response time was 4 milliseconds with caching:

a graph showing increased response times on a WordPress website using PHP 7

a chart showing increased hit rates on a WordPress website using PHP 7

Comparison these results with the previous version of PHP, we see remarkable improvements in performance and boilerplate response time. When we ran the same tests on PHP five.5, the server was hitting 24,731 times with nada errors and naught timeouts. Simply, the average response fourth dimension was much slower at 208 milliseconds.

For even more ways to speed up your WordPress website, check out our tips to improve WordPress site performance.

Improved Security

PHP'south popularity makes it a common target for cyberattacks. To counter these attacks, new PHP releases comprise patches to vulnerabilities exposed by hackers. If your WordPress site is running an old version of PHP, it won't accept these fixes in identify and volition be more susceptible to malware, viruses, and unwanted access to your site's backend.

New PHP alone won't proceed intruders out. Meet our guide to WordPress security for steps on how to harden your WordPress site

Better Compatibility

WordPress websites are fabricated upward of multiple parts, and when 1 component upgrades, the rest tend to follow. The all-time WordPress themes and plugins, also as WordPress itself, always run on the latest version of PHP. If you're stuck on a previous version, the lack of compatibility betwixt PHP and your core files, plugins, and theme might interruption your website.

As a WordPress administrator, you lot don't need to know the nitty-gritty details most how PHP works. However, knowing how to update PHP is a must. Allow'due south get started.

1. Cheque your current PHP version.

To make certain your system requires a PHP update, y'all tin can check in WordPress. From the ambassador dashboard, select Tools > Site Health. Under Site Health Status, WordPress will tell you if your version of PHP should be updated, forth with other security and operation improvement recommendations.

the Site Health Status window in WordPress

2. Check compatibility with the latest PHP version.

Earlier upgrading your WordPress Site to PHP seven, make sure information technology'southward uniform with new PHP. The easiest fashion to exercise this is by using the plugin PHP Compatibility Checker.

The PHP Compatibility Checker plugin for updating PHP in WordPRess

But install and run the plugin through WordPress to check your existing code. If the plugin finds whatever bug, yous'll run into a listing of errors and warnings along with specific code details to help make primal changes before upgrading.

3. Back up your website.

Near WordPress tutorials will advise you to create a backup of your site earlier making significant changes, and updating PHP is no exception. The actual switch to PHP typically won't bring up any testify-stopping issues. But, just in case, information technology's always ideal to have a failsafe backup handy.

four. Update your WordPress core, plugins, and agile theme.

With a fill-in on mitt, y'all tin can begin preparing your website for the update itself. To forbid functionality issues stemming from poor compatibility with PHP, bank check that all your add together-ons and your core files are running their latest versions. Check this nether Dashboard > Updates and click Update all if prompted.

Any quality plugin and theme will work with PHP 7 — if non, find a meliorate choice that does.

five. Update your PHP version.

Now for the bodily updating function. The module that processes PHP code is installed on your site's web hosting server. When I say, "updating PHP version," this module is what nosotros're actually changing. Because the inner-workings of PHP are handled by your server, whatsoever PHP updates are done through your host

There are 2 ways to update PHP on your host, by contacting your hosting provider, or past updating manually if possible. Here I'll explicate how to do both.

Talk to Your Hosting Provider

The more hands-off option for a PHP upgrade is reaching out to your host direct via chat, email, or phone, and simply asking. In most cases, your provider will have care of this for you, or add an upgrade option to your hosting control console forth with instructions.

In some cases, your host might offer an automating upgrading service. If then, make sure you've run compatibility tests and fixed any errors, since the hosting provider isn't responsible if something goes wrong with your site.

Other providers may not support PHP 7 and take no plans to switch. In this case, consider moving to a new WordPress host. The benefits of PHP seven outweigh the inconvenience of transferring domains.

Update PHP Manually

While hosting control panels differ beyond providers, one of the about common is cPanel.

To make the switch, navigate to the Software/Service tab and search for a PHP option. And then, click Select PHP Version. You'll meet this screen:

the cpanel dashboard php version selector

The highlighted drop-downwards lets you set your current PHP version. So long as your hosting provider has done their job, some variant of PHP 7 should exist bachelor. Once you've selected version 7 from the drop-downwards menu, click Save or Prepare as Current.

This process volition vary slightly betwixt hosts. If y'all get stuck, read over your provider's documentation or help resources, and reach out to support if you need to.

6. Check your updated site.

Requite your host at least 30 minutes for the PHP to fully update. So, brand sure your WordPress site still works by viewing all your pages and testing your plugins one-by-one. If in that location'due south a problem, you may be able to revert to your one-time PHP version in cPanel or by contacting your host again. If worse comes to worst, y'all have a fill-in continuing by to reset your update.

And with that, you're all set. PHP vii will bring your site many benefits over previous iterations. Sit back and enjoy the increased performance, enhanced functionality, tighter security, and happier visitors.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Originally published Dec 1, 2021 12:23:00 PM, updated Dec 07 2021