Changing PHP Version in DirectAdmin: Guide
The right PHP version is essential for the performance and security of your website. In this guide, we explain how to change the PHP version in DirectAdmin.
Why PHP Version is Important
PHP is the programming language that powers most websites, including WordPress, WooCommerce, and other CMS systems. Newer PHP versions offer:
Benefits of New PHP Versions
- Speed: PHP 8.x is up to 3x faster than PHP 7.x
- Security: Older versions no longer receive security updates
- Compatibility: New plugins and themes often require PHP 8+
- Functionality: New features and improvements
PHP Version Lifecycle
| Version | Status | End of Support |
|---|---|---|
| PHP 7.4 | End of Life | December 2022 |
| PHP 8.0 | End of Life | November 2023 |
| PHP 8.1 | Active | November 2024 |
| PHP 8.2 | Active | December 2025 |
| PHP 8.3 | Current | December 2026 |
Recommendation: Use at least PHP 8.1, preferably PHP 8.2 or 8.3.
Checking PHP Version
In WordPress
- Go to Tools → Site Health
- Click on Info
- Look for Server → PHP Version
Via DirectAdmin
- Log in to DirectAdmin
- Go to PHP Settings or Domain Setup
- You will see the current PHP version
Via PHP File
Upload a file phpinfo.php with:
<?php phpinfo(); ?>
Open this in your browser and look for "PHP Version".
Delete this file after checking! (security risk)
Changing PHP Version
Method 1: Via Domain Setup
- Log in to DirectAdmin
- Go to Domain Setup or Website Settings
- Click on your domain
- Look for PHP Version Selector or PHP Version
- Select the desired version (e.g., PHP 8.2)
- Click on Save
Method 2: Via PHP Settings
- Log in to DirectAdmin
- Go to PHP Settings or PHP Configuration
- Select your domain (if you have multiple)
- Choose the PHP version from the dropdown menu
- Click on Apply
Method 3: Per Subdomain
You can use different PHP versions per subdomain:
- Go to Subdomain Management
- Click on the subdomain
- Change the PHP version specifically for that subdomain
- Click on Save
Before the Change: Check Compatibility
WordPress Compatibility
- Update WordPress to the latest version
- Update all plugins and themes
- Check the plugin descriptions for PHP requirements
- Make a backup before changing
Common Compatibility Issues
Deprecated Functions:
mysql_*functions no longer work (usemysqli_*or PDO)ereg_*functions have been removed (usepreg_*)each()function has been removed in PHP 8
Strict Types: PHP 8 is stricter with types. This can cause errors in older code.
After the Change
Testing the Website
- Open your website in the browser
- Test all pages
- Check forms
- Test the shopping cart (if you have an online store)
- Check the admin/backend
Common Problems
White Screen of Death:
- PHP error - check the error logs
- Incompatible plugin - deactivate plugins one by one
- Theme issue - switch to the default theme
500 Internal Server Error:
- Syntax error in code
- Incorrect .htaccess configuration
- PHP memory limit reached
Plugin/Theme Not Working:
- Update to the latest version
- Look for an alternative
- Contact the developer
Adjusting PHP Settings
In addition to the version, you can also change PHP settings:
Increasing Memory Limit
- Go to PHP Settings in DirectAdmin
- Look for
memory_limit - Increase to 256M or 512M
- Click on Save
Increasing Upload Limit
- Go to PHP Settings
- Change
upload_max_filesize(e.g., 64M) - Change
post_max_size(a bit higher, e.g., 68M) - Click on Save
Increasing Execution Time
For longer processes:
- Go to PHP Settings
- Change
max_execution_time(e.g., 300) - Click on Save
Rolling Back to an Older Version
If your website does not work after the upgrade:
- Go back to PHP Settings or Domain Setup
- Select the previous PHP version
- Click on Save
- Test your website
This is a temporary solution. Plan to update your code for compatibility with newer PHP versions.
Tips for PHP Updates
- Test Locally First: Test in a staging environment before production
- Always Make a Backup: Database and files
- Update Gradually: Don’t jump from 7.4 to 8.3, but go through 8.1
- Check Error Logs: Check logs after changing
- Keep Plugins Up-to-Date: Outdated plugins are often the cause of issues
Related Articles
- Extra domains and parked domains in DirectAdmin
- Using File Manager in DirectAdmin
- Creating an FTP account in DirectAdmin
Need Help?
We are here for you! Are you facing any issues or have questions? Our support team is happy to assist you personally. Send us a message via the ticket system - we usually respond within a few hours and are happy to help.
0 van 0 vonden dit nuttig