As a WordPress ambassador, updates are key to your job. For optimal functionality and strong security, yous need to ensure that your theme, plugins, and WordPress core are running their latest versions.

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

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

In this postal service, I'll embrace what you need to know near 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 often used on the web. Showtime released in 1995 as a general-purpose programming language, PHP has go a favorite tool among developers for enabling dynamic web pages. Dynamic spider web pages are those which are generated past the hosting server when requested by a client, rather than stored on the server in their entirety.

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

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

What does PHP do in WordPress?

Rather than store each website folio separately as individual HTML files, WordPress contains many PHP files that each control a different office of your page, such as headers and footers, comment sections, etc. If you look at your WordPress file names, yous'll detect these files terminate with a ".php" extension.

On your WordPress site, the primary job 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 code pulls relevant page content from your WordPress database, converts it into an HTML file (and accompanying CSS files), and sends the HTML dorsum to the visitor who made the request.

Why assemble pages this mode? In a word, flexibility. In conjunction with HTML and CSS, PHP makes it possible for developers to create themes and must-have WordPress plugins that run on their own PHP files. These themes and plugins tin can utilize WordPress database content however they like. If you lot want to swap plugins and/or themes, this setup likewise lets you do so without the need to generate a new gear up of pages every fourth dimension. Every folio on your site is generated in real-time when requested.

Additionally, PHP is a good fit for WordPress because, like WordPress itself, PHP is open-source. Anyone can meet how the linguistic communication works under the hood and customize it for their site if desired.

PHP and the CMS Revolution

While PHP enjoyed some popularity in the web development community for years, the appearance of Content Management Systems (CMS) really put this linguistic communication on the map. WordPress is the almost popular CMS on the cyberspace, and this fact is a testament to the robustness and versatility of PHP.

What is PHP vii?

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

Today, more than eighteen% of WordPress sites utilise PHP 7, with many plugins and themes actively supporting this version. PHP upgrades are ongoing, and PHP 8 will exist released in late 2020.

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

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

Why Yous Should Upgrade Your PHP in WordPress

WordPress and many WordPress hosts make updates easy with automation. Withal, manual updates tin be a hassle. Is upgrading PHP really worth your time?

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

Increased Speed

Between releases, PHP developers update the language to utilise resources more efficiently and introduce new features and functions. This means that each new release of PHP will run your WordPress website faster than before. Not only will better performance keep visitors engaged with your site — it can also boost your rankings in search engines.

To evaluate PHP 7 performance, we tested PHP vii on WordPress in a strictly controlled surroundings. The server was hitting 37,378 times with zero errors and zero timeouts. The average response fourth dimension 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

Comparing these results with the previous version of PHP, we come across remarkable improvements in performance and average response fourth dimension. When we ran the aforementioned tests on PHP 5.5, the server was hit 24,731 times with zero errors and zero timeouts. But, the average response time was much slower at 208 milliseconds.

For even more than ways to speed upwardly your WordPress website, check out our tips to amend WordPress site performance.

Improved Security

PHP's 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 place and will be more than susceptible to malware, viruses, and unwanted access to your site'south backend.

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

Amend Compatibility

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

Every bit a WordPress administrator, you lot don't need to know the nitty-gritty details about how PHP works. Even so, knowing how to update PHP is a must. Let'south get started.

1. Bank check your current PHP version.

To make sure your system requires a PHP update, yous tin bank check in WordPress. From the administrator dashboard, select Tools > Site Wellness. Under Site Health Condition, WordPress will tell you if your version of PHP should be updated, along with other security and performance improvement recommendations.

the Site Health Status window in WordPress

2. Check compatibility with the latest PHP version.

Before upgrading your WordPress Site to PHP seven, make sure information technology'due south uniform with new PHP. The easiest way to do this is past 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 whatsoever bug, yous'll see a list of errors and warnings along with specific code details to help make key changes before upgrading.

3. Support your website.

Most WordPress tutorials will advise y'all to create a backup of your site before making pregnant changes, and updating PHP is no exception. The actual switch to PHP typically won't bring up any show-stopping issues. But, just in example, it's always platonic to have a failsafe backup handy.

4. Update your WordPress core, plugins, and active theme.

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

Whatever quality plugin and theme will work with PHP 7 — if not, find a better option that does.

5. Update your PHP version.

Now for the actual updating part. The module that processes PHP lawmaking is installed on your site's spider web hosting server. When I say, "updating PHP version," this module is what nosotros're actually irresolute. Because the inner-workings of PHP are handled by your server, whatever PHP updates are washed 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 practise both.

Talk to Your Hosting Provider

The more than hands-off choice for a PHP upgrade is reaching out to your host directly via chat, e-mail, or telephone, and just asking. In most cases, your provider will take care of this for you, or add an upgrade option to your hosting control panel along with instructions.

In some cases, your host might offering an automating upgrading service. If so, 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 back up PHP vii and accept no plans to switch. In this instance, consider moving to a new WordPress host. The benefits of PHP vii outweigh the inconvenience of transferring domains.

Update PHP Manually

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

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

the cpanel dashboard php version selector

The highlighted drib-downward lets yous set your current PHP version. Then long as your hosting provider has done their task, some variant of PHP seven should be available. Once you've selected version vii from the drop-downwards menu, click Salve or Set equally Current.

This process will vary slightly between hosts. If you get stuck, read over your provider'south documentation or help resources, and reach out to support if yous need to.

vi. Check your updated site.

Give your host at to the lowest degree 30 minutes for the PHP to fully update. Then, brand certain your WordPress site still works by viewing all your pages and testing your plugins one-by-one. If there's a problem, you may be able to revert to your sometime PHP version in cPanel or by contacting your host again. If worse comes to worst, yous have a backup continuing by to reset your update.

And with that, yous're all set. PHP vii will bring your site many benefits over previous iterations. Sit down back and enjoy the increased functioning, 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 December 07 2021