Which php version is best

PHP version stats: July, 2022

It’s that time again: my biyearly summary of which PHP versions are used across the community. I know I’m a little early, that’s because I had some spare time today and wanted to make sure I got it ready in time. You can read the January edition here.

As always, it’s important to note that I’m working with the data available to us. That means that these charts are no 100% accurate representation of the PHP community as a whole, but they are an accurate representation of one of the most prominent parts of PHP: the packagist ecosystem.

# Usage Statistics

Let’s start with the percentage of PHP versions being used today, and compare it to the previous two editions:

Version July, 2021 (%) January, 2022 (%) July, 2022 (%)
8.1 0.1 9.1 24.5
8.0 14.7 23.9 20.6
7.4 46.8 43.9 38.4
7.3 19.2 12.0 8.0
7.2 10.4 6.6 5.1
7.1 3.8 2.4 1.9

Note that I’ve omitted all versions that don’t have more than 1% usage. Visualizing this data looks something like this:

As expected during a year with a minor release instead of a major one: PHP 8.1 is growing, and PHP 8.0’s usage is already declining. A good sign that developers are updating! Keep in mind that PHP 8.0 is still actively supported for another four months. So if you kept off on updating to PHP 8.1, now is a good time.

Less good news — although not unexpected: more than 50% of developers are still on PHP 7.4 or lower. That’s not an insignificant number, considering that PHP 7.4 only receives security updates for 5 more months, and all older versions simply aren’t supported anymore.

I did hope to see PHP 8.X adoption to be climbing more rapidly, I’ve shared some of my thoughts about it here, if you want some more reading.

PHP in 2023

Interface Default Methods

Moving on the the all-time overview chart, here you can see the evolution of version usage across time:

It’s interesting to compare the 5.5 peak in 2014 to the 7.4 peak two years ago. PHP 5.5 and subsequent versions saw a much faster decline as soon as PHP 7.0 became available, compared to PHP 7.4’s decline when PHP 8.0 was released. I’m a little worried that PHP 8.0 wasn’t as exciting as PHP 7.0 back in the day.

Читайте также:  Adding images to html email

Fear for upgrading shouldn’t be a blocker these days compared to eight years ago: we now have mature tools like Rector and PHP CS that take care of almost the whole upgrade path for you.

So why aren’t people upgrading to PHP 8.0? Why are more people staying with PHP 7.4 compared to the 5.5 and 5.6 days? I don’t have a definitive answer.

# Required versions

Part of the answer though (I think) lies with the open source community: what are packages requiring as their minimal version? Are they encouraging their users to update, or not?

I used Nikita’s popular package analyzer to download the 1000 most popular composer packages. Next, I used a little script to get the lowest version each package supports from their composer.json file. Here are the results:

Version July, 2021 (#) January, 2022 (#) July, 2022 (#)
8.1 125
8.0 117 160 94
7.4 56 69 86
7.3 133 116 104
7.2 142 133 130
7.1 182 190 153
7.0 31 29 29
5.6 61 49 42
5.5 43 42 35
5.4 41 43 40
5.3 97 83 77
5.2 12 10 10
5.0 2 2 1

I have mixed feelings about this data. On the one hand it’s good to see PHP 8.1 as the minimum required version for 125 packages. However, look at how many packages still require a version lower than PHP 8.0: 707 out of 926 packages analysed. That’s more than 75%!

Oh, as a side note: there only are 926 packages because some of the 1000 most popular packages don’t specifically require a PHP version.

Let’s plot this data into a chart:

I won’t say that the open source community is the only responsible factor here, but I do want to encourage you to think carefully about your responsibilities if you are an open source maintainer. We’re not just talking about new and shiny PHP features here: we’re talking about performance, software security for the most popular programming language on the web, and even about the impact of old PHP versions on electricity usage and server requirements, in Rasmus’ words we can help save the planet.

Читайте также:  Укороченные логические операторы java

What are your thoughts on these stats? Are you already using PHP 8.1? Let me know your thoughts on Twitter and subscribe to my newsletter if you want to be kept up-to-date about these posts!

Noticed a tpyo? You can submit a PR to fix it. If you want to stay up to date about what’s happening on this blog, you can follow me on Twitter or subscribe to my newsletter:

Источник

WordPress PHP Versions: Best PHP for WordPress in 2023

FI WordPress PHP Version Compatibility

Different WordPress versions can work with multiple PHP versions. Yet, the platform recommends specific PHP requirements for each WP version. Choosing the best WordPress PHP version is crucial to make sure that the website is secure and free of bugs.

This article discusses the compatibility between PHP and WordPress in terms of the recommended, minimum, and latest PHP versions for WordPress.

IMPORTANT: This article is being checked and updated regularly by our team to reflect the most accurate and up-to-date information. In case you found anything incorrect or inaccurate please don’t hesitate to contact us.

LAST UPDATED: May 04, 2023

In this article:

1. Overview

WordPress substantially relies on PHP to work and operate. Updates for both platforms are being published regularly to fix security loopholes and bring enhancements in usability and performance. Thus, WordPress users have to continuously update their software and confirm its compatibility with supported PHP versions.

WordPress PHP versions depend on the compatibility between WordPress and PHP. As each version of WP requires specific minimum PHP requirements. In this context, this article aims to explore the compatibility of the multiple versions of WordPress with PHP, in light of continuous updates being published on a regular basis for both platforms.

2. Supported PHP Versions

Updates of PHP programming language are being published regularly. The updates usually include bug fixes and security improvements besides other functional and performance enhancements.

When published, each PHP version remains supported for a period of 3 years from its initial stable release , the support period runs over two main successive phases:

  • 2-Years Active Support: the support includes fixing BOTH BUGS and SECURITY ISSUES.
  • 1-Year Security Support: the support includes fixing ONLY CRITICAL SECURITY ISSUES.

PHP Versions Lifetime

Once the support period is completed (after 3 years), the version reaches its end of life (EOL) and becomes no longer supported. It’s strongly not recommended to use an unsupported version of PHP as it might expose the application using it to security vulnerabilities and bugs.

Читайте также:  Vertical Line in html

3. WordPress Current PHP Versions

The official PHP website maintains a specific webpage to check the status of supported versions. Accordingly, the currently supported PHP versions that can be safely used for WordPress are:

  • PHP Version 7.4– No Longer Supported
  • PHP Version 8.0(Security Support, ends on 26/11/2023)
  • PHP Version 8.1(Active Support, ends on 25/11/2023)
  • PHP Version 8.2(Active Support, ends on 08/12/2024)

When an older PHP version runs out of support, it is removed from the list and, usually, a new version with full support is added.

4. WordPress PHP Requirements

In general, WordPress requires specific server requirements, which cover PHP requirements, hosting details, and other software dependencies.

Technically speaking, each version of WordPress has specific PHP versions that it is compatible with. That being said, although the software might work on legacy PHP versions that reached their End Of Life, the platform recommends using only supported PHP versions.

Important: a compatible PHP version is a version that WordPress requires to work properly, regardless of whether it is still supported or not.

Here is a list of the compatible PHP versions for each version of WordPress, knowing that we only consider WP versions that can work with the currently supported PHP versions:

WordPress Check PHP Version

To read our easy guide with pictures to finding PHP version in WordPress without a plugin please refer to this article. In case you are unable to access the admin control panel, you can find the PHP version by accessing your hosting cPanel or consulting your hosting service provider.

FI Check WordPress Php Version Without Plugin

How to Check PHP Version in WordPress Without Plugin?

There are many ways to check the PHP version being used by a WordPress installation, usually using third-party plugins. In this article, we will find step-by-step how to check PHP version in WordPress without any plugin.

9. Conclusion

To avoid vulnerabilities and obtain the best performance for your website, WordPress and PHP versions should be always compatible with each other.

In this article, we discussed the PHP requirements of WordPress platform in terms of compatibility and possibly usable PHP versions.

  • PHP Supported Versions: https://www.php.net/supported-versions.php
  • WordPress Requirements: https://wordpress.org/about/requirements/
  • WordPress Server Environment: https://make.wordpress.org/hosting/handbook/server-environment/
  • PHP Compatibility and WP Versions: https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/

Источник

Оцените статью