
Table of Contents
1. Why Change PHP Version?
PHP powers over 80% of websites worldwide, including WordPress, Joomla, and Drupal. Each PHP version has a defined End of Life (EOL) date. Once a version reaches EOL, it no longer receives security patches, leaving your site vulnerable to attacks.
Key reasons to change PHP version:
- Security — Outdated PHP versions have unpatched vulnerabilities
- Performance — PHP 8.x is 30–50% faster than PHP 7.x for typical workloads
- Compatibility — New plugins and themes require newer PHP versions
- New features — PHP 8.x brings named arguments, fibers, and JIT compilation
PHP in 2026: PHP 8.2 and 8.3 are the recommended versions for new projects. PHP 7.4 reached End of Life at the end of 2022.
2. Comparing PHP Versions
Overview of PHP versions commonly found on hosting:
| Version | Status | Security Support | Recommendation |
|---|---|---|---|
| PHP 7.4 | End of Life | Ended (Dec 2022) | Not recommended — legacy use only |
| PHP 8.0 | End of Life | Ended (Nov 2023) | Not recommended |
| PHP 8.1 | Security Fix Only | Dec 2025 | Acceptable — good for older WP |
| PHP 8.2 | Active Support | Dec 2026 | Recommended — stable |
| PHP 8.3 | Active Support | Nov 2027 | Recommended — latest |
AsiaGB Hosting supports PHP 7.4, 8.0, 8.1, 8.2, and 8.3. You can switch versions instantly through DirectAdmin without contacting support.
3. Changing PHP via DirectAdmin
DirectAdmin includes a PHP Version Selector for easy version management. Follow these steps:
- Log in to DirectAdmin at
yourdomain.com:2222or the URL provided - Navigate to Advanced Features or Software
- Click PHP Version Selector or PHP Selector
- Select the domain to modify (if you have multiple domains)
- Choose your desired PHP version from the dropdown
- Click Save or Apply
- Wait a moment, then refresh your website
Note: PHP version changes take effect immediately without a server restart. Per-domain PHP Selector allows different PHP versions for each domain on the same account.
If you can't find the PHP Version Selector
If the menu isn't visible in DirectAdmin, try these alternative locations:
- Extra Features → PHP Version Manager
- Domain Setup → PHP Version (per domain)
- User Level → Top right menu → PHP
If still not found, contact AsiaGB support via Ticket to request a PHP version change.
4. Changing PHP via .htaccess
You can also specify PHP version for a specific directory using .htaccess:
# Change PHP for this directory only
AddHandler application/x-httpd-php82 .php
# Or using fcgi
AddHandler fcgid-script .php
FCGIWrapper /usr/local/bin/php82-cgi .php
Warning: The .htaccess syntax for PHP may vary depending on server configuration. If this doesn't work, contact support to confirm the correct handler.
Using the DirectAdmin PHP Selector is generally preferred as it's more reliable and works with all server configurations.
5. Verifying Your PHP Version
After changing PHP, always verify the correct version is active:
Method 1: phpinfo()
<?php
// Create info.php — delete it after checking!
phpinfo();
?>
Method 2: PHP CLI
php -v
Method 3: WordPress Health Check
In WordPress Admin → Tools → Site Health → Info → Server, the current PHP version is displayed.
Important: Delete info.php immediately after checking. The phpinfo() output reveals server configuration details that could assist attackers.
6. Essential PHP Extensions
Key extensions required for WordPress and general web applications:
| Extension | Purpose | WordPress |
|---|---|---|
| curl | HTTP requests, API calls | Required |
| gd / imagick | Image processing, thumbnails | Required |
| mbstring | Multibyte strings (Thai, Chinese) | Required |
| mysqli / pdo_mysql | MySQL database | Required |
| openssl | SSL/TLS, encryption | Required |
| xml / xmlreader | XML parsing, RSS | Required |
| zip | Archive, plugin installation | Required |
| opcache | PHP code caching | Highly recommended |
| intl | Internationalization | Recommended |
| sodium | Cryptography (WP 5.2+) | Recommended |
In DirectAdmin, extensions can be managed via PHP Selector → Extensions. Some hosting plans may limit which extensions can be modified.
7. Troubleshooting After PHP Change
Common issues after changing PHP version and how to resolve them:
White Screen or 500 Error
Usually caused by a plugin or theme incompatible with the new PHP version:
- Switch back to the previous PHP version temporarily
- Check the PHP error log in DirectAdmin → Files → Log Viewer
- Deactivate plugins one by one to identify the problematic one
- Update all plugins and themes to the latest version before upgrading PHP
Functions or Features Not Working
PHP 8.x removed or changed behavior of some PHP 7.x functions:
each()removed in PHP 8.0create_function()removed in PHP 8.0- Implicit string-to-int conversion changed in PHP 8.0
str_contains(),str_starts_with()added in PHP 8.0 (not available in 7.x)
Database Connection Error
Verify that the new PHP version has the mysqli or pdo_mysql extension enabled. Check via phpinfo() or DirectAdmin PHP Extensions.
Sessions or Cookies Not Working
Check session.save_path in php.ini and the permissions of the session storage directory.
8. PHP Version for WordPress
WordPress recommends these PHP versions based on current releases:
| WordPress Version | Recommended PHP | Minimum PHP |
|---|---|---|
| WordPress 6.4+ | PHP 8.2 or 8.3 | PHP 7.4 |
| WordPress 6.0–6.3 | PHP 8.1 or 8.2 | PHP 7.4 |
| WordPress 5.x | PHP 8.0 or 8.1 | PHP 7.4 |
Steps to Upgrade PHP for WordPress
- Backup — Always back up both database and files first
- Check plugin compatibility — Review plugin pages for tested PHP version
- Update WordPress, plugins, themes — Update everything to the latest versions first
- Test on staging — If you have a staging environment, test there first
- Change PHP on production — Via DirectAdmin PHP Selector
- Test the site — Check all key pages, forms, and features
Tip: AsiaGB Hosting includes Softaculous with automatic backup functionality. Use it to create a backup before changing PHP. AsiaGB also provides twice-monthly automated backups (1st and 15th of each month).
9. Frequently Asked Questions (FAQ)
Summary
Changing PHP version on DirectAdmin Hosting is quick and easy via the PHP Selector. Upgrading to PHP 8.2 or 8.3 delivers better security and performance. Always back up your site first, and test thoroughly after the change. If you encounter issues, AsiaGB's support team is available 24/7 via Ticket to help.