Which PHP version should I choose for my website?
Does your website run on PHP? Then choosing the right version is crucial for the performance, security and compatibility of your website. In this article we explain how to pick the best PHP version for your situation. Whether you run WordPress, Laravel, Joomla or a custom website: after reading this article you will know exactly which PHP version is the right choice.
What is PHP and why does the version matter?
PHP is the programming language behind most websites and content management systems. More than 77% of all websites use PHP, including WordPress, Joomla, Drupal and Magento. Every new PHP version brings improvements in three areas:
- Speed - newer versions are significantly faster than older ones
- Security - security holes are patched in supported versions
- Functionality - new features and improved syntax for developers
Overview of PHP versions and their status
Not every PHP version is still supported. Here is the current overview:
| PHP version | Release date | Active support until | Security updates until | Status |
|---|---|---|---|---|
| PHP 7.4 | November 2019 | November 2021 | November 2022 | End of Life |
| PHP 8.0 | November 2020 | November 2022 | November 2023 | End of Life |
| PHP 8.1 | November 2021 | November 2023 | December 2025 | Security only |
| PHP 8.2 | December 2022 | December 2024 | December 2026 | Security only |
| PHP 8.3 | November 2023 | December 2025 | December 2027 | Actively supported |
| PHP 8.4 | November 2024 | December 2026 | December 2028 | Actively supported |
Choosing a PHP version: which one is best?
The short answer: choose the newest PHP version that is compatible with your website and plugins. In most cases that is PHP 8.3 or 8.4. But it depends on your specific situation.
For WordPress websites
WordPress officially supports PHP 7.4 through 8.3 (and 8.4 experimentally). Our recommendation for WordPress websites:
- PHP 8.2 or 8.3 - the safest and fastest choice for most WordPress sites
- PHP 8.1 - if you have plugins that are not yet compatible with 8.2+
- PHP 7.4 - only as an absolute last resort for very old plugins (unsafe!)
For Laravel applications
Laravel requires at least PHP 8.1 (Laravel 10) or PHP 8.2 (Laravel 11). Always use the newest supported version for the best performance.
For Joomla websites
Joomla 4 supports PHP 7.2.5 through 8.2. Joomla 5 requires at least PHP 8.1. Choose PHP 8.2 or higher for optimal compatibility and security.
For Magento/Adobe Commerce
Magento 2.4.6 supports PHP 8.1 and 8.2. Always check the compatibility matrix of your specific Magento version before you change the PHP version.
The speed gain of newer PHP versions
One of the main reasons to choose the newest PHP version is the huge speed gain. Every major PHP version was significantly faster than its predecessor:
| Version upgrade | Speed improvement | Impact on WordPress |
|---|---|---|
| PHP 5.6 to 7.0 | 200-300% faster | Pages load 2-3x faster |
| PHP 7.0 to 7.4 | 10-25% faster | Noticeable improvement |
| PHP 7.4 to 8.0 | 10-20% faster | JIT compiler for complex tasks |
| PHP 8.0 to 8.1 | 5-15% faster | Fibers for async tasks |
| PHP 8.1 to 8.2 | 5-10% faster | Memory optimization |
| PHP 8.2 to 8.3 | 5-10% faster | Improved OPcache |
The switch from PHP 7.4 to PHP 8.3 can make your website up to 40% faster. This has a direct impact on the user experience and your position in search engines, because Google uses loading speed as a ranking factor.
Security risks of old PHP versions
Running an unsupported PHP version is a serious security risk. Once a PHP version reaches End of Life, no more security patches are released. This means newly discovered vulnerabilities are not fixed.
Why this is dangerous
- Known vulnerabilities - attackers know the weak spots of old versions and actively scan for websites running them
- Automated attacks - bots automatically exploit known PHP vulnerabilities
- Compliance problems - PCI-DSS and GDPR require you to keep software up to date
- Chain attacks - a hacked website can be used to attack other systems
Choosing and changing the PHP version at your hosting provider
At most hosting providers you can change the PHP version easily through the control panel. With DirectAdmin it works like this:
- Log in to DirectAdmin
- Go to Domain Setup or PHP Version
- Select the desired PHP version from the dropdown menu
- Click Save
- Test your website thoroughly after the change
Checklist for changing the PHP version
- Make a backup of your website and database
- Check the compatibility of your CMS, themes and plugins
- Test on a staging environment if possible
- Change the version through the control panel
- Test all functionality of your website
- Check the error logs for PHP errors or warnings
- Monitor performance in the days after the change
Frequently asked questions about choosing a PHP version
Can changing the PHP version break my website?
Yes, that is possible if your website or plugins contain code that is not compatible with the new version. That is why it is important to make a backup first and preferably test on a staging environment. If there are problems, you can always switch back to the previous version.
How do I know which PHP version my website is currently running?
You can check this in your hosting control panel, or by creating a PHP file with the phpinfo() function. In WordPress you can see the PHP version under Site Health in the dashboard.
Should I always use the newest PHP version?
Not necessarily the very newest. A recently released version (such as PHP 8.4 at the moment) may still have compatibility problems with some plugins and CMS versions. Wait until your CMS and plugins officially support the new version. PHP 8.3 is currently the safest choice for most websites.
The right PHP version is essential for the speed, security and stability of your website. Always choose the newest version that is compatible with your website, but test thoroughly before you make the switch. Avoid End of Life versions such as PHP 7.4 and 8.0, because they no longer receive security updates.
At Theory7 we support all current PHP versions and you can switch easily through DirectAdmin. Need help choosing or changing your PHP version? Our support team is happy to help you find the optimal configuration for your website.
Choosing a PHP version: advanced considerations
Besides the basic choice, there are advanced factors that can influence your PHP version choice.
PHP modules and extensions
Not all PHP extensions are available on every version. Some extensions are removed in newer versions, while others are added. Check which extensions your website needs and whether they are available on the desired PHP version. Common extensions are GD or Imagick for image processing, cURL for HTTP requests, mbstring for multibyte strings and Intl for internationalization.
OPcache configuration
OPcache is a PHP extension that keeps compiled PHP code in memory, so the same code does not need to be recompiled every time. In newer PHP versions, OPcache is enabled by default and better optimized. Make sure OPcache is active at your hosting provider for maximum performance.
PHP-FPM vs CGI
PHP can be run in different ways on a web server. PHP-FPM (FastCGI Process Manager) is the fastest and most efficient method. CGI and suPHP are older methods that are slower. Check with your hosting provider whether PHP-FPM is available and can be enabled for optimal speed.
Choosing a PHP version per CMS: a detailed overview
| CMS/Framework | Minimum PHP | Recommended PHP | Maximum PHP |
|---|---|---|---|
| WordPress 6.4+ | 7.4 | 8.2 or 8.3 | 8.3 |
| WooCommerce 8+ | 7.4 | 8.2 | 8.3 |
| Joomla 5 | 8.1 | 8.2 | 8.3 |
| Drupal 10 | 8.1 | 8.2 | 8.3 |
| Laravel 11 | 8.2 | 8.3 | 8.4 |
| Magento 2.4.7 | 8.2 | 8.3 | 8.3 |
| PrestaShop 8 | 7.4 | 8.1 | 8.1 |
Common compatibility problems
When upgrading to a newer PHP version, you may run into the following problems:
- Deprecated functions are functions that worked in older versions but have been phased out in newer ones. They first generate warnings and are later removed entirely.
- Type strictness has increased in PHP 8.x. Code that previously handled data types loosely may now produce errors.
- Named arguments in PHP 8.0+ can conflict with functions that use the same parameter names as internal functions.
- Null safety has become stricter. Functions that received null where a string was expected now give a warning or error.
How do you test compatibility before you change the PHP version?
Testing compatibility before you actually change the PHP version saves you a lot of headaches. Here are a few methods:
PHP Compatibility Checker for WordPress
The "PHP Compatibility Checker" plugin for WordPress scans your themes and plugins for compatibility problems with the desired PHP version. Install the plugin, select the target PHP version and start the scan. The report shows exactly which files will cause problems.
Using a staging environment
The safest way to test is on a staging environment: a copy of your website where you can test changes without impact on the live site. Many hosting providers offer staging functionality. Copy your website to the staging environment, change the PHP version there and test all functionality thoroughly.
Monitoring error logs
After changing the PHP version, the error logs are your best friend. Check the PHP error logs in your hosting control panel for errors, warnings and deprecated notices. Fix any problems or switch back to the previous version if there are critical errors.
Choosing the right PHP version and keeping it up to date is one of the simplest ways to make your website faster, safer and more reliable. Take the time to test your website after every upgrade and you will benefit from better performance and a safer online presence.
Summary: choosing the right PHP version
To keep it clear, here are the key points for choosing the right PHP version for your website:
- Always use the newest PHP version that is compatible with your CMS and plugins
- PHP 8.3 is currently the best choice for most websites thanks to the combination of speed, security and broad compatibility
- Avoid PHP versions that are End of Life: they no longer receive security updates and pose a risk
- Always make a backup before you change the PHP version
- Test on a staging environment if possible, or check all functionality thoroughly after the change
- Monitor the error logs after every change for errors and warnings
- Enable OPcache for maximum performance improvement
- Check every 6 to 12 months whether a newer PHP version is available that you can use
By regularly updating your PHP version, you benefit from better performance, stronger security and the newest capabilities of the language. This is one of the simplest and most effective ways to improve your website.
Choosing a PHP version: compatibility and migration
When choosing a PHP version, compatibility with your existing code is the most important consideration. An upgrade to a newer version offers big benefits, but requires careful planning.
Recognizing deprecated functions
Every new PHP version removes functions that are marked as deprecated. In the transition from PHP 7 to PHP 8, several commonly used functions were removed or changed. The mysql_ extension was replaced by mysqli_ and PDO. Several string functions behave differently with null values. Understanding these changes prevents your website from crashing after a PHP upgrade. Use the PHP Compatibility Checker tool to automatically scan your code for incompatibilities.
Upgrade plan
Never run a PHP upgrade directly on your production server. Follow this plan for a safe migration. First make a full backup of your website and database. Test your website on a staging environment with the new PHP version. Fix any errors and warnings. Test all functionality thoroughly, including forms, payment processes and plugins. Only run the upgrade on production once everything works flawlessly on staging. Monitor your website extra closely in the first days after the upgrade.
PHP version compatibility overview
| Software | PHP 7.4 | PHP 8.0 | PHP 8.1 | PHP 8.2 | PHP 8.3 |
|---|---|---|---|---|---|
| WordPress 6.x | Yes | Yes | Yes | Yes | Yes |
| WooCommerce 8.x | Limited | Yes | Yes | Yes | Yes |
| Laravel 10.x | No | No | Yes | Yes | Yes |
| Drupal 10.x | No | No | Yes | Yes | Yes |
| Joomla 5.x | No | No | Yes | Yes | Yes |
Choosing a PHP version: performance and new features
Every new PHP version brings significant performance improvements and useful new features. This is an important reason to keep your PHP version current.
Performance improvements per version
PHP 8.0 introduced the JIT compiler (Just-In-Time), which dramatically improves execution speed for compute-intensive tasks. PHP 8.1 added fibers for asynchronous programming and enum support. PHP 8.2 brought readonly classes and the phasing out of dynamic properties. PHP 8.3 added typed class constants and improved json_validate functionality. Each version is measurably faster and more memory-efficient than the previous one.
The right version for your situation
Always use the newest stable PHP version that is compatible with your software. For WordPress sites, PHP 8.2 or 8.3 is the recommended choice in 2026. For legacy applications that have not been updated, PHP 8.1 is the minimum safe level. PHP 7.4 has reached the end of its life cycle and no longer receives security updates. If you are still running PHP 7.4, plan an upgrade to at least PHP 8.1 as soon as possible for the security of your website.
Want to know more about server optimization? Read our article on improving website speed for additional performance tips.
Choosing a PHP version: frequently asked questions and practical tips
When choosing a PHP version for your website, many of the same questions come up. Below we answer the most frequently asked questions with practical tips.
How do I check which PHP version my website uses?
The simplest way is through your hosting panel. In DirectAdmin you find the PHP version under Domain Settings. You can also create a PHP info file by uploading a file with phpinfo() to your web server. Do not forget to delete this file right after checking, because it exposes sensitive server information. In WordPress you find the PHP version under Site Health in the dashboard.
Frequently asked questions about PHP versions
- Can I run multiple PHP versions at the same time? Yes, most modern hosting environments support multiple PHP versions. You can set a different PHP version per domain or even per directory.
- What if my website does not work after a PHP upgrade? Switch back to the previous PHP version immediately through your hosting panel. Investigate the error messages in the PHP error log to identify and fix the incompatibility before you upgrade again.
- How long are PHP versions supported? Each PHP version receives two years of active support and one year of security updates. After three years in total, the version no longer receives updates and using it is a security risk.
- Is PHP 8 much faster than PHP 7? Yes, PHP 8.x is on average 20 to 40 percent faster than PHP 7.4 for most web applications. The JIT compiler in PHP 8 offers even bigger improvements for compute-intensive tasks.
- Do I have to change my code with a PHP upgrade? With a minor version upgrade (for example 8.1 to 8.2), changes are rarely needed. With a major upgrade (7.4 to 8.0), thorough testing is essential and code changes are often required.
Choosing a PHP version: summary and recommendations
Choosing the right PHP version is an important decision that affects the performance, security and compatibility of your website. Here we summarize the essential recommendations.
Recommendations per situation
For new websites and projects, always choose the newest stable PHP version, currently PHP 8.3. For existing WordPress websites, PHP 8.2 is the recommended version that offers the best balance between compatibility and performance. For legacy applications that have not been updated, PHP 8.1 is the minimum safe level. If you are still running PHP 7.4, plan an upgrade as soon as possible because this version no longer receives security updates.
Annual PHP version review moment
Schedule an annual review moment for your PHP version. Check whether a newer stable version is available. Test your website on a staging environment with the new version. Fix any compatibility problems. Run the upgrade on your production server and monitor performance. Through this annual ritual, your website always runs on a supported and safe PHP version with the best performance. Combine this with updating your CMS, plugins and themes for a complete maintenance moment.
Choosing a PHP version: compatibility check and testing strategies
When choosing a PHP version for an upgrade, a thorough compatibility check is essential. Start by checking the minimum PHP requirements of your CMS, theme and all installed plugins. Use a staging environment to test the new PHP version without affecting your live website. Enable error reporting to identify deprecated functions and incompatibilities. Test all critical functionality, including forms, payments, login processes and API integrations. Document any problems and look for updates or alternatives for incompatible components before you push the change to production.
Support and life cycle of PHP versions
Every PHP version goes through a fixed life cycle consisting of active support followed by security updates only. After the end of the life cycle, a version no longer receives updates, leaving known vulnerabilities unpatched. Plan your PHP upgrades well before the current version reaches the end of its life cycle. Subscribe to the official PHP mailing list or follow php.net to stay informed about release dates and end-of-life announcements for the version you use.