How to Change Your PHP Version
Different websites and applications require different PHP versions. Whether you need to upgrade to the latest PHP for improved performance and security, or use an older version for compatibility with legacy software, {{COMPANY_NAME}} hosting makes it easy to switch PHP versions. This guide covers how to change your PHP version in cPanel, DirectAdmin, and Plesk.
Why Change Your PHP Version?
There are several reasons you might need to change your PHP version:
- Application requirements: WordPress, Joomla, Laravel, and other applications specify minimum PHP versions
- Performance improvements: Newer PHP versions (8.x) are significantly faster than older ones
- Security: Older PHP versions reach end-of-life and no longer receive security patches
- New features: Modern PHP includes features like named arguments, enums, fibers, and improved type systems
- Compatibility: Some legacy applications may not work with the newest PHP versions
Tip: Always check your application's requirements before changing the PHP version. Upgrading to an incompatible version can break your website.
Changing PHP Version in cPanel
Method 1: MultiPHP Manager (Recommended)
- Log in to cPanel
- Navigate to the Software section
- Click MultiPHP Manager
- You will see a list of all your domains
- Check the box next to the domain you want to change
- From the PHP Version dropdown at the top, select your desired version
- Click Apply
The change takes effect immediately. Visit your website to verify it works correctly.
Method 2: MultiPHP INI Editor
To modify PHP settings (not the version) for a specific domain:
- Go to Software > MultiPHP INI Editor
- Select the Basic Mode or Editor Mode tab
- Choose your domain from the dropdown
- Adjust settings as needed:
- upload_max_filesize
- post_max_size
- max_execution_time
- memory_limit
- max_input_vars
- Click Apply
Available PHP Versions in cPanel
Typically available versions include:
- PHP 7.4 — Legacy support (end of life, security fixes only)
- PHP 8.0 — Major update with JIT compiler, union types
- PHP 8.1 — Enums, fibers, intersection types
- PHP 8.2 — Readonly classes, DNF types
- PHP 8.3 — Typed class constants, json_validate()
Note: Available versions depend on server configuration. Contact support if you need a specific version that is not listed.
Changing PHP Version in DirectAdmin
Using the PHP Version Selector
- Log in to DirectAdmin
- Navigate to Account Manager > Domain Setup
- Click on your domain name
- Look for the PHP Version Selector option
- Select your desired PHP version from the dropdown
- Click Save
Alternative Method: PHP Selector (CloudLinux)
If your server uses CloudLinux:
- Go to Extra Features > Select PHP Version (or PHP Selector)
- Choose the desired PHP version from the dropdown at the top
- Optionally, enable or disable PHP extensions
- Click Set as Current or Save
Per-Directory PHP Version
You can set different PHP versions for different directories:
- Go to PHP Selector
- Use the directory selector to choose the target directory
- Set the PHP version for that specific directory
- Subdirectories inherit the parent's PHP version unless overridden
Changing PHP Version in Plesk
- Log in to Plesk
- Go to Websites & Domains
- Click on PHP Settings (or PHP Version) for your domain
- Select the desired PHP version from the dropdown
- Optionally, choose the PHP handler:
- FPM application — best performance (recommended)
- FastCGI application — good compatibility
- CGI application — legacy support
- Click OK or Apply
Verifying Your PHP Version
After changing the version, verify it is active:
Method 1: phpinfo() File
- Create a file named
phpinfo.phpin your website root:
<?php
phpinfo();- Visit
https://yourdomain.com/phpinfo.phpin your browser - The page will display the current PHP version and configuration
- Delete this file immediately after checking — it exposes sensitive server information
Method 2: Check via SSH
php -vNote: The CLI PHP version may differ from the web PHP version.
Method 3: WordPress Dashboard
If running WordPress:
- Go to Tools > Site Health > Info
- Expand the Server section
- The PHP version is listed there
Configuring PHP Settings
After changing the PHP version, you may need to adjust settings:
Common PHP Settings
| Setting | Default | Recommended for Most Sites |
|---|---|---|
| upload_max_filesize | 2M | 64M |
| post_max_size | 8M | 64M |
| max_execution_time | 30 | 300 |
| max_input_time | 60 | 300 |
| memory_limit | 128M | 256M |
| max_input_vars | 1000 | 5000 |
Adjusting Settings in cPanel
- Go to Software > MultiPHP INI Editor
- Select your domain
- Modify the desired values
- Click Apply
Adjusting Settings via .htaccess (Apache with mod_php)
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value memory_limit 256MAdjusting Settings via .user.ini (PHP-FPM/FastCGI)
Create or edit .user.ini in your document root:
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
memory_limit = 256MNote: .user.ini changes may take up to 5 minutes to take effect due to PHP's caching of ini files.
PHP Extensions
Some applications require specific PHP extensions. To manage them:
In cPanel (CloudLinux PHP Selector)
- Go to Software > Select PHP Version
- Click on Extensions
- Check or uncheck extensions as needed
- Click Save
Common Extensions You Might Need
- mysqli / pdo_mysql — MySQL database connectivity
- gd / imagick — Image processing
- curl — HTTP client functionality
- mbstring — Multibyte string support
- zip — ZIP archive handling
- intl — Internationalization
- opcache — PHP bytecode caching (performance)
- sodium — Modern cryptography
Troubleshooting After PHP Version Change
Website Shows a Blank Page or 500 Error
- The new PHP version may be incompatible with your code
- Switch back to the previous version to restore functionality
- Check the error log in cPanel (Metrics > Errors) for specific errors
- Common issue: deprecated functions removed in newer PHP versions
WordPress Plugins Not Working
- Update all plugins and themes before upgrading PHP
- Check plugin compatibility with your new PHP version
- Disable plugins one at a time to find the incompatible one
- Contact the plugin developer for an update
PHP Errors in Error Log
- Deprecated warnings: Functions are outdated but still work (upgrade your code)
- Fatal errors: Functions have been removed (code must be updated)
- Parse errors: Syntax incompatible with the new PHP version
Application-Specific Compatibility
| Application | Minimum PHP | Recommended PHP |
|---|---|---|
| WordPress 6.x | 7.4 | 8.1+ |
| Joomla 5.x | 8.1 | 8.2+ |
| Drupal 10.x | 8.1 | 8.2+ |
| Laravel 11.x | 8.2 | 8.3+ |
| Magento 2.4.x | 8.1 | 8.2+ |
Best Practices
- Test before switching: If possible, test your site with the new PHP version in a staging environment
- Update your software first: Update CMS, plugins, and themes before upgrading PHP
- Keep PHP current: Use the latest stable PHP version your application supports
- Monitor error logs: Watch for deprecation warnings that may become errors in future versions
- Back up first: Always create a backup before changing the PHP version
- Delete phpinfo.php: Remove any phpinfo files after checking — they are a security risk
- Review release notes: Check PHP release notes for breaking changes when upgrading major versions
Related Articles
- Understanding PHP Version Compatibility
- Troubleshooting 500 Internal Server Errors
- Managing PHP Settings on Shared Hosting
Need help changing your PHP version? Contact our support team at {{SUPPORT_EMAIL}} or visit {{SUPPORT_URL}}.