Which php version choose
More than 75%of websites use PHP as the development language.The popularity of wordpress, phpmyadmin and other open source projects,Bring a large number of long tail users.However, they are rarely upgraded after installation.The following figure is the current usage statistics of PHP.
Amazingly,The left half of the figure shows the version of PHP that is no longer supported. PHP 5.2 is no longer maintained as early as January 2011.This does not mean that you cannot use it,But this means some security updates,You cannot follow up.Some distributions will try to fix some bugs, but your version of php seems a bit unkind,Because you are using outdated technology from 2006.
Where to start
No one has chosen php 5.2, but these things have happened,But I’m not saying what I write about this blog,Not to mention giving you some upgrade guides.Usually they use some hosting space from 2006,They have a «long-term support» version to avoid using newer versions,Or they have no current plans to upgrade.Or, for a lot of reasons.However, good things are waiting for you in the new version of php.
php 5.3Added a lot of useful oop features! For example:anonymous functions,spl extensions are not just iterators,The fabulous datetime extensions have been integrated into PHP 5.3. The extremely important e_deprecated error report flag is also added.It reminds you of the features you use now,Will not be available in the next version.If you are already using PHP 5.3, your upgrade path will be smoother.If your cable program is running on an earlier version,I do not recommend that you upgrade.
php 5.4A series of optimizations were performed,It has faster execution efficiency and less memory footprint.Here are the results of the benchmark.
No matter what traits you use, PHP 5.4 improves program performance,And reduce hardware costs.Therefore, I recommend that you keep upgrading when using open source software.
PHP 5.5 is still being tested,Not suitable for production environments.Since PHP 5.3, the risks and changes of the upgrade will be greatly reduced.
The following is an article organized by Mai Zi
Everyone must be very confused when choosing the php version,Which version do you choose?
We now have a new server.Using windows server 2008 r2. Configure the php 5.4 environment.
But we used 2003, php was version 5.2, ported to the new server,Will the program run affect it?Or do I need to pay attention to those issues?
api version
PHP uses a large version of the backward compatible upgrade method,In other words, 5.5 is compatible with 5.1-5.4. That being said,Compatibility is not optimistic,Don’t expect any good solution from php official.Now in September 2013, the version has 5.2.17 5.3.27 5.4.17 5.5.3
This version is arguably the most widely supported version.Most open source software still uses this version,For example, drupal7.23, joomla2.5, most domestic software:dedecms5.7, discuzx3, etc. The latest version still supports 5.2, if there is no special requirement,Installing this version is the most worry-free,But in the long run, it may be abandoned.Now many hosts are too lazy to upgrade the php version in order to save manpower costs, which are basically supported anyway.(Insert here,Now that domestic software is compatible with more installation environments,Can be described as well-intentioned,Even php5.1 can support it (disuzx3 does not support it), the most rare thing is that the performance is not much behindIt’s not easy to be as honest as possible! ) Drupal6 recommends using this version.
5.3.28 (recommended)
Although this version starts with the name 5, many people think that it is the beginning of the php6.0 version.Performance has improved,And because many APIs have changed,Not very compatible with 5.2,Although some open source software claims to be compatible with 5.2-5.3, it seems that there are many problems.Many simply give up 5.2, for example joomla3 only supports 5.3 or more. For drupal7 it is strongly recommended to use this version,The support is pretty good.This version can also be used for drupal8,The support is also pretty good.This version is very widely used,Make a good balance between performance and compatibility.
5.4 (lightly recommended)
5.4 is basically close to completeness,It is relatively complete now.Stability and performance are also good,Key releases for future upgrades,drupal7.x support is okay,But third-party modules are not perfect.If you are too lazy to upgrade later,You can install this version in one step.
Starting from 5.3, future versions are basically focused on performance improvements.Functions are backward compatible.5.5 seems to have a 64-bit version from the beginning, the performance is more powerful,I haven’t tried it,Dare to speak.
If the open source software says that it is recommended to install php5.3, then you should be honest and practical 5.3, do not use 5.5 or something, you may think that it is compatible anywayPerformance may be better,Why not use a new one?That being said,But you know that open source software is generally developed in a specific environment when developing,Even if the compatibility is as good as possible, there will be unexpected surprises (no strong team can perform compatibility testing on all function APIs,That’s a terrible workload! ), It will only be tested and optimized in specific environments,And even if you know there is a problem with compatibility,The team will not modify it for compatibility with later versions.Not that they are rigid,It is considered for security and stability.In an open source atmosphere,We should have a consciousness that «sufficient is the best», not «latest is the best». For example,joomla3.1 runs poorly in 5.4-5.5,Even the installation was unsuccessful.But drupal also runs normally (native) under 5.5.3. I think it is a separate case?But it seems that there are unexpected errors in the operation,I do n’t know if it ’s a version issue,I hope not.
none-thread-safe or thread-safe
Apache generally chooses none-thread-safe, iis chooses the latter (fast-cgi), I will not explain.Nobel is right.
ts refers to thread safety,This version is usually selected when iis is loaded in isapi mode.
nts is none-thread safe, generally choose this version when running in fast cgi mode,Has better performance.
From the first windows version of php3.0.17 released on October 20, 2000, all are thread-safe versions.This is because unlike the Linux/Unix system which uses a multi-process working method, the Windows system uses a multi-thread working method.If you run php in cgi mode under iis it will be very slow,This is because the cgi mode is based on multiple processes.Not multi-threaded.Generally, we will configure php to run as isapi.isapi is a multi-threaded way,This is much faster.But there is a problem,Many commonly used PHP extensions are developed based on the linux/unix multi-process idea.These extensions will break iis when run in isapi mode. Therefore, cgi mode is the safest way to run PHP under IIS.But the cgi mode needs to reload and unload the entire php environment for each http request, and its consumption is huge.
In order to balance the efficiency and security of PHP under IIS,Microsoft gave a solution for fastcgi.fastcgi allows php processes to be reused instead of restarting a process for every new request.At the same time fastcgi can also allow several processes to execute at the same time.This not only solves the problem that the cgi process mode consumes too much,It also uses the advantage of the cgi process mode without thread safety issues.
Therefore, if you are using isapi to run PHP, you must use the thread safe version;while running PHP in fastcgi mode, there is no need to use thread safety checkUse none thread safe (nts, non-thread-safe) version can better improve efficiency.
If your system is 64-bit, choose 64-bit. If your system is 32-bit, choose 32-bit.
To be honest, the future belongs to those who use php5.4 and above.Keep upgrading,Regularly tracking the new features and progress of the language is part of our daily work.If you are already behind,Then I highly recommend you start your upgrade plan,Upgrade to a newer version.The effort is worth it,After all, the program runs over the years.
WordPress PHP Versions: Best PHP for WordPress in 2023
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.
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.
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:
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.
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/