Steps to Check and Manage PHP Version?
Are you running the optimal PHP version for your web projects? Your PHP version choice impacts your website's security and capabilities.
The article explores the steps to check and manage various PHP versions.
Key Takeaways
-
The support timeline for each PHP version explains which are secure and obsolete.
-
Check your PHP version using the command line or server tools.
-
Run various PHP versions across sites using tools like CloudPanel and Apache.
-
CloudPanel makes PHP version management easier.
-
Common PHP compatibility issues include removed functions and type changes.
What is the PHP Versioning System?
PHP follows a semantic versioning system with three numbers:
-
Major versions are PHP 7 to PHP 8. These introduce significant changes and may break backward compatibility.
-
Minor versions like 8.3 to 8.4 bring new features but keep compatibility.
-
Patch versions like 8.3.19 to 8.3.20 address bugs and security issues.
Each PHP version gets 2 years of active support and 1 extra year of security-only updates. After that, it reaches end-of-life and no longer receives updates. These are vulnerable to threats.
PHP 8.3 is the latest stable version, with the most recent patch being 8.3.20. We expect the release of the upcoming PHP 8.5 in November 2025.
3 Steps to Check Your PHP Version
1. Command Line Methods
If you have PHP installed on your computer, whether on Linux or Windows. You have SSH access to your server. You can check the PHP version using the terminal:
How to Check:
Open your terminal or command prompt and type:
php -v
The command shows:
-
The PHP version number
-
Build date
-
Thread safety
-
Zend Engine and OPcache versions
It is useful for developers or server admins who work with the system or deploy via SSH.
2. Server-Based Methods
If you use a web hosting service or don't have terminal access, you can:
1. Check the PHP version through your server’s configuration or control panel.
a. Using a PHP file
- Create a new file called phpinfo.php and add the following code:
<?php phpinfo(); ?>
- Upload this file to your server's root directory and visit it in your browser:
https://yourdomain.com/phpinfo.php
It will display a full PHP configuration report, including:
-
PHP version
-
Loaded extensions
-
Configuration directives
-
Server environment variables
Note: Delete this file afterward to avoid exposing server info to the public.
b. Using the Hosting Control Panel
If you use a control panel like cPanel or Plesk:
-
cPanel: Go to Select PHP Version or PHP Info under the Software section.
-
Plesk: Navigate to Websites & Domains, then go to PHP Settings to see or change your PHP version.
These panels often allow you to switch PHP versions for domains or directories.
3. CMS-Specific Methods
Most modern content management system platforms provide tools to check server configuration. These include PHP version information.
a. WordPress
-
Go to Tools → Site Health → Info → Server
-
Look for PHP Version under the Server section.
b. Joomla
-
Navigate to System → System Information → PHP Information
-
You will see your PHP version and extra environment details.
c. Drupal
-
Visit Reports → Status Report
-
"Web server" or "PHP" lists the PHP version.
These tools are helpful for non-tech users or site admins who manage sites via CMS dashboards.
7 Versions of PHP
1. PHP 8.5
It is currently in development with preview builds available for testing. The expected release is November 2025. PHP 8.5 will introduce:
-
New built-in functions:
1. curl_multi_get_handles() retrieves active cURL handles
2. get_exception_handler() and get_error_handler() get the currently registered global handlers
-
Improves debugging by showing stack traces even on fatal errors.
-
locale_is_right_to_left() detects the text direction based on the locale.
-
array_first() and array_last() access an array's first or last element.
-
php --ini=diff compare and display differences between loaded and default configuration files.
2. PHP 8.4
Released in November 2024 and currently in active support. PHP 8.4 brought several additions, including:
-
Allows intercepting property hooks, enabling custom behaviors on read and write operations.
-
Provides more granular control of property and asymmetric visibility in classes.
-
Improves performance by lazy-loading objects until needed
-
Introduced HTML5 compatibility in the DOM extension for better front-end/back-end consistency.
-
Optimized the performance and efficiency of Just-in-Time compilation.
3. PHP 8.3
Released on November 23, 2023, and supported until December 25, 2025. It receives security support until December 25, 2026. PHP 8.3 brought several improvements, including:
-
Enforces strict typing on class constants, improving code reliability.
-
Improved date and time exceptions with more detailed error messages, simplifying debugging.
-
PHP now supports more consistent and accurate handling of INI environment variables.
-
Enables the use of a dynamic class to fetch constants.
-
Simplifies immutable object definitions by marking an entire class as read-only.
4. PHP 8.2
Released on December 8, 2022, and ended active support on December 8, 2024. It receives security support until December 8, 2025.
Key Features:
-
You cannot change properties marked as read-only after initialization.
-
Write complex disjunctive normal form type rules with better logic.
-
Use enum properties in constant contexts.
-
Reduces accidental property misuse by requiring explicit declarations.
-
Still secure, but feature development has stopped.
5. PHP 8.1
Released on November 25, 2021, and ended active support on November 25, 2023. Security support ended on November 25, 2024.
Key Features:
-
Enables cooperative multitasking. It is the foundation for async PHP in frameworks like ReactPHP.
-
Offer official enumeration support.
-
A step toward full read-only classes in PHP 8.3.
-
Performance improvements, such as JIT enhancements and smaller memory footprint.
6. PHP 8.0
Released on November 26, 2020, and ended active support on November 26, 2023. It is not supported.
Key Features:
-
Call functions with parameter names for readability.
-
Accept various types.
-
Declare and initialize class properties.
-
More concise and safer switch alternatives.
-
Avoids null reference errors.
-
Do not use it in production; it doesn’t provide security patches.
-
The major release introduced new syntax and better type handling.
7. PHP 7.4
Released on November 28, 2019, and ended active support on November 28, 2022. Modern packages and frameworks do not support it.
Key Features:
-
Introduced type declarations for class properties.
-
Short syntax for anonymous functions.
-
Spread operator in arrays for improved array unpacking.
-
Load core files into memory at startup for performance.
Despite these timelines, many websites still run on outdated versions. As of early 2025, 25% of PHP websites continue to use PHP 7.x versions. It creates significant security risks.
4 Steps to Manage Various PHP Versions Across Different Sites
1. Using CloudPanel
CloudPanel is a lightweight yet powerful server control panel. It is best for developers and system administrators. It is particularly best for self-managed VPS hosting. It also supports modern stacks with high performance.
Features:
-
Install and manage various PHP versions, such as 7.4 and 8.3.
-
Creates each site with a specific PHP version during or after setup.
-
Each site uses its own PHP-FPM worker, ensuring performance and stability.
-
Switch PHP versions via an intuitive web GUI or using terminal CLI commands.
The flexibility is ideal for hosting legacy apps alongside newer ones on the same server.
2. Apache + PHP-FPM (Manual Configuration)
It is best for custom VPS or bare-metal servers using Apache. Apache can use different PHP-FPM pools per site.
-
Install various PHP versions.
-
Enable and start FPM services.
-
In each site’s VirtualHost
It is flexible and scalable. It requires careful FPM management and permissions.
3. Nginx + PHP-FPM
-
It is best for high-performance setups. Nginx uses different upstreams for PHP per site.
-
It is fast and efficient. It is more complex to configure than Apache.
4. Command Line Switching (for Dev Environments)
Use tools like:
-
update-alternatives (Debian/Ubuntu)
-
brew-php-switcher (macOS + Homebrew)
-
Docker: Use containers with specific PHP versions per project inside isolated environments.
-
Laravel Valet (macOS/Linux): You can set the PHP version for each project.
How CloudPanel Simplifies Multi-PHP Management?
1. Per-Site PHP Version Selection
When adding a new website or editing an existing one:
-
Go to Sites and select or add a site.
-
Choose the desired PHP version in the site setup wizard.
-
CloudPanel configures NGINX and PHP-FPM with that version for that specific site.
It removes the need to:
-
Edit FPM pool files.
-
Adjust socket paths.
-
Restart PHP services.
2. Simple Installation of PHP Versions
To install a new PHP version, run:
clp php install 8.2
CloudPanel takes care of:
-
Installing PHP binaries.
-
Configuring FPM.
-
Integrating it into the web server.
-
Making it available in the UI for selection.
No need to handle complex dependencies or compilation.
3. Easy Switching Between Versions
Want to change the PHP version for a site?
-
Go to the site's settings in the dashboard.
-
Pick a new PHP version from the dropdown.
-
CloudPanel updates NGINX and FPM. It also restarts the necessary services.
There is no risk of downtime or misconfiguration.
5 PHP Version Compatibility Issues and Solutions
1. Deprecated or Removed Functions
Deprecates older functions and is later removed in newer versions.
Example:
-
create_function() deprecated in PHP 7.2, removed in 8.0.
-
Remove each() in PHP 8.0.
Solution:
-
Replace deprecated functions with modern alternatives.
-
Use tools like PHPCompatibility for automated detection.
2. Strict Type Changes
PHP 7+ introduced scalar type declarations and return types. PHP 8+ enforces them better.
Problem:
Functions with loose typed parameters may now cause warnings or errors.
Solution:
-
Update function signatures to match declared types.
-
Enforce type hints using static analysis, such as PHPStan or Psalm.
3. Changes in Default Behavior
The behavior of some built-in functions changes between versions.
Examples:
-
count() on non-countable objects throws an error in PHP 7.2+.
-
implode() parameter order clarified in PHP 7.4.
Solution:
-
Review PHP’s migration guides.
-
Update usages to match new expected behaviors.
4. Incompatible Libraries or Frameworks
Older versions of CMSs like WordPress or Laravel may not support newer PHP versions.
Solution:
-
Update to a compatible version of the CMS or framework.
-
Replace outdated plugins or modules with maintained alternatives.
5. Extension Support Changes
Remove or replace some PHP extensions.
Examples:
-
Remove mcrypt in PHP 7.2.
-
mysql is not mysqli removed in PHP 7.0.
Solution:
-
Use openssl or Sodium for encryption.
-
Replace mysql_* functions with mysqli or PDO.
FAQs
1. What is the latest version of PHP?
As of May 2025, the latest stable version of PHP is 8.3.20. PHP 8.5 is currently in development and expected in November 2025. PHP 8.3 will receive active support until December 2025.
2. Why should I upgrade to the latest PHP version?
Upgrading keeps your site secure with the latest security patches. You also gain performance improvements and modern language features. It helps ensure compatibility with newer frameworks and libraries.
3. Is PHP still relevant in 2025?
PHP powers over 43% of all websites, including major platforms. WordPress and other custom applications use it. PHP continues to evolve with modern features and strong community support.
4. How often should I update my PHP version?
Update at least every 2–3 years to stay within supported versions. Security only support ends after three years, increasing the risk. Use the latest stable version for best performance and security.
5. What if my application doesn't work with newer PHP versions?
Use code analysis tools to find compatibility issues. Hire a developer to modernize your application if needed. Isolate legacy apps using Docker or VMs with the required PHP version.
Summary
The PHP version enhances security and provides new features that simplify development. The article explores the key features of the PHP versions, including:
-
Major updates may break compatibility, add features, and patch bugs.
-
PHP 8.3 is current, and we expect PHP 8.5 in November 2025.
-
Use terminal (
php -v
), phpinfo files, hosting panels, or CMS dashboards. -
Use CloudPanel, Apache/Nginx with PHP-FPM, or Docker for a flexible setup.
Simplify PHP version management with CloudPanel, a free hosting control panel. Switch PHP versions per site and install updates.