What is PHP?
PHP is a server-side programming language, meaning the programs it helps develop are executed by the server, not the client. Other notable server-side languages include Java and C++. When a site visitor requests a web page containing PHP code, the code is processed by the PHP module on the webserver. After this, the PHP pre-processor generates an HTML output that displays on the site.
One fundamental difference between PHP and HTML is the dynamic ability of PHP. For example, while PHP and HTML integrate extremely well PHP can actually generate HTML code. By entering a set of commands written in PHP, the code engine executes server script resulting in an HTML page rendered by the browser.
Common uses for PHP include data retrieval from SQL databases and graphics creation, such as designers create image links or using the language to power thumbnail image galleries. Other notable uses include password features, user authentication, and forum-post management.
What is PHP7?
PHP7 is the latest version of PHP. Released in December 2015, PHP7 is a significant upgrade over the previous iteration, PHP 5.6. Wondering what happened to PHP6? While work began on version 6 in 2005, the project encountered serious issues and was eventually scrapped. Given the poor community reception of PHP6, developers opted to start over and skip straight to PHP7.
This latest version of include several notable improvements over PHP 5.6:
Increased speed — PHP7 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 stopping the entire code script. PHP7 allows the script to continue running and throws an error instead.
PHP and the CMS Revolution
While PHP enjoyed significant popularity in the web development community for years, the advent of Content Management Systems (CMS) put this language on the map. WordPress, the most widely used CMS, is a PHP-based platform. In many respects, the success of WordPress is an important indicator of the robustness and versatility of PHP.
The success of WordPress was also an important factor in the release of PHP7 in December 2015. During this version’s development phase the WordPress community was eager to examine and test every element of PHP7 and ensure compatibility with the platform. Today, more than 18% of WordPress sites use PHP7, with many plugins and themes actively supporting this version. While PHP upgrades are ongoing, PHP8 won’t be released until 2021.
If you’re considering improving your site performance by moving your site operations to Wordpress, you’re probably curious about how the platform handles different development languages, PHP included. To help make your switch a bit easier, (and a bit less stressful too!) we recently tested PHP7 to measure performance.
Testing WordPress with PHP7
We tested PHP7 on WordPress in a strictly controlled environment. The server was hit 37,378 times with 0 errors and 0 timeouts. The average response time was 4ms on WordPress Vanilla with caching. See the statistics below.
If you compare results with the previous version, you will observe remarkable improvements in performance and average response time. In PHP 5.5, the server was hit 24,731 times with 0 errors and 0 timeouts with the average response time of 208 ms.
How to Upgrade Your WordPress Site to PHP7
Step 1: Check Compatibility
Before upgrading your WordPress Site to PHP7, make sure it’s compatible with new PHP code.
Simply install and run the plugin through your WordPress hosting platform to check your existing code. If any problems are found, you’ll get a list of errors and warnings along with specific code details to help make key changes before upgrading to PHP7.
Step 2: Talk to Your Hosting Provider
If your site checks out, the shortest path to a PHP7 upgrade is through your hosting provider. Get in touch — via chat, email or phone — and ask them to upgrade your site to PHP7.
In some cases, they may offer 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 support PHP7 and have no plans to switch. In this case consider moving to a new host, since the benefits of PHP7 far outweigh the inconvenience of transferring domains.
The most likely scenario, however, is that your hosting provider will add an option to upgrade your site through your hosting control panel.
Step 3: Make the Upgrade Manually
While panels differ across web hosts, one of the most common is cPanel, which looks like this:
Head to the Software/Service tab and search for “php”. Then, click “Select PHP Version” and you’ll see this screen:
The highlighted drop-down box lets you choose your current PHP7 version; so long as your hosting provider has done their job, some variant of version 7 should be available. The most recent version — 7.4.2 — was released on January 23rd, 2020.
Once you’ve selected version 7 from the drop-down menu, click “Save” at the bottom and you’re finished.
Step 4: Check Your Site
Last but not least? Make sure your WordPress site still works. Check out current pages from the control panel and also navigate to the site from the Internet at large — if there’s a problem, you may still be able to roll back the version in cPanel.
Making the Switch
PHP7 offers significant benefits over previous iterations. Upgrade your WordPress site today and enjoy increased performance, enhanced operations, and improved error controls.
Originally published Feb 28, 2020 5:33:03 PM, updated February 28 2020