If you’re running WordPress sites, you’ve probably heard the term “latest PHP version” thrown around. Well-known sites like Facebook and Wikipedia are websites developed using the PHP language. Additionally, 40% of the web is powered by WordPress which is built using PHP. But, what is it? And why do you have to use the latest version?
What is PHP?
PHP is a general purpose scripting language used in web development and is widely used by some of the largest websites on the internet. PHP stands for “PHP: Hypertext Preprocessor.” The language is open source and free to use.
What is the Latest PHP Version?
As of the time of this writing, the latest PHP version is 8.1. This will be actively supported by the PHP Foundation until the 25th of November in 2023, with security updates continuing for another year thereafter.
Why Are There Multiple PHP Versions?
Cell phones update regularly. Computer games get patches. The same goes for PHP. Each PHO version introduces new features as planned by the maintainers of the language. Versioning allows for development teams to safely update to new versions or migrate from one major version to another.
All-in-one WordPress solutions
Power your site with the industry's most optimized WordPress hosting
Why It's Important to Use the Latest PHP Version
There are a number of reasons why you’d want to use the latest PHP version. Here are a few to consider.
The growth of PHP has seen many new features, especially in recent years, which make PHP even more powerful. Not only is access to PHP for web development increasingly common, it also offers top notch features that compare with other powerful languages. If you aren’t using the latest PHP version, then you are missing out on these latest features.
Active Maintenance and Bug Fixes
Sustainable software is supported by frequent and consistent updates in response to bug reports. Keeping up to date with each release of the latest PHP version ensures the most stable experience that the features set has to offer.
It is important to remember that security issues come around and need to be addressed swiftly and effectively. Using the latest PHP version ensures the longevity of security updates. While older versions of PHP offer security updates for a time past “end of life,” the most secure option is the version that is actively maintained.
Complete Guide to PHP Versions
|PHP Version||Release Date||Key Features|
|PHP 8.1 (PHP current version)||November 25, 2021||Enumerations, read-only properties, noreturn type, new in initializers, final class constants, fibers (asynchronous PHP)|
|PHP 8.0||November 26, 2020||Major performance improvements, just-in-time compilation, nullsafe operator, match expression, constructor property promotion, union types, mixed type, static return type|
|PHP 7.4||November 28, 2019||Custom object serialization, null coalescing assignment operator, reflection for references, foreign function interface|
|PHP 7.3||December 6, 2018||Reference assignment for destructured arrays, flexible heredoc and nowdoc syntax|
|PHP 7.2||November 30, 2017||Object type hint, abstract function overriding|
|PHP 7.1||December 1, 2016||Void return type, class constant visibility|
|PHP 7.0||December 3, 2015||Major performance improvements, null coalescing operator, return types|
|PHP 5.6||August 28, 2014||Variadic functions, argument unpacking|
It is important to note that PHP 6 was never released. While originally planned, PHP 6 was abandoned and the release following PHP5.x continued with PHP 7.x. This jump in the version number was largely to prevent confusion when discussing the abandoned PHP 6 as compared to the to-be-release version following PHP 5.6.
Additionally, PHP versions are available for download all the way back to PHP 1 on the PHP museum website, for those that are interested.
How to Tell Which PHP Version You’re On
The command php -v will provide the active PHP CLI version. Note that this may be different than the version of PHP running on the server, which is used to serve web requests.
phpinfo() of phpversion() functions
PHP offers multiple functions for displaying server configuration information. This information is typically for debugging purposes and should not be made publicly accessible as some of the information may be abused.
In your local environment, you can use the phpinfo() function to render a table of server configuration details in an easy to read (and search) table.
Additionally, for quick access to the PHP version you can use the phpversion() function to simply return the active PHP version used by the server.
The WordPress administrator dashboard has a site health tool (under Tools -> Site Health) that details the server configuration on which the site is installed. Listed here is the installed PHP version.
How to Update Your PHP Version
If you want to be on the latest PHP version, here’s how to update it.
Update PHP Using apt on Ubuntu, Debian, Linux
A specific version of PHP can be installed using the apt command-line utility, following the naming convention of phpX.X, for example php8.0 or php7.4.
The below command will install PHP version 8.0:
sudo apt-get install php8.0
Multiple versions of PHP can be installed, but only one PHP version can be activated at a time.
Assuming an active version of PHP 7.4 updating to PHP 8.0, the following script will disable PHP 7.4 and enable PHP 8.0:
sudo a2dismod php7.4sudo a2enmod php8.0sudo service apache2 restartsudo update-alternatives --set php /usr/bin/php8.0
PHP Version FAQs
How Many Versions of PHP Are There?
Starting with version 1, the PHP ecosystem is currently at version 8.x. This is not to include the unreleased version 6 of PHP, so there are currently 7 major versions of PHP.
What is in the Latest PHP Version?
The latest PHP version is 8.x, which features major performance improvements in addition to major features that bring support for stability and predictability in the code.
Is PHP 7.4 End of Life?
PHP 7.4 is receiving security updates only. This means that reported security vulnerabilities will result in patch releases, but will not include any new features. Security updates will end for PHP 7.4 on November 28th, 2022 at which point PHP 7.4 will be considered end of life.
Which Version of PHP is Best?
The best version of PHP is generally the latest version of PHP that is available for use. For new projects, this will usually mean PHP 8.x is the place to get started. For existing projects, there are compatibility considerations that may require some code updates to ensure that the project is compatible with any breaking changes in the latest release.
Try Fully Managed WordPress Hosting from Nexcess
Fully managed WordPress hosting from Nexcess brings out the best in your site.
Automatic image compression, a built-in content delivery network (CDN), and advanced WordPress caching features make your site load at a hyper speed. At the same time, iThemes Security PRO will make sure your site is secure.
And just in case something goes amiss, Nexcess’ WordPress experts are there for you 24/7.