StarDomain

How to Change Your PHP Version

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:

  1. Application requirements: WordPress, Joomla, Laravel, and other applications specify minimum PHP versions
  2. Performance improvements: Newer PHP versions (8.x) are significantly faster than older ones
  3. Security: Older PHP versions reach end-of-life and no longer receive security patches
  4. New features: Modern PHP includes features like named arguments, enums, fibers, and improved type systems
  5. 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

  1. Log in to cPanel
  2. Navigate to the Software section
  3. Click MultiPHP Manager
  4. You will see a list of all your domains
  5. Check the box next to the domain you want to change
  6. From the PHP Version dropdown at the top, select your desired version
  7. 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:

  1. Go to Software > MultiPHP INI Editor
  2. Select the Basic Mode or Editor Mode tab
  3. Choose your domain from the dropdown
  4. Adjust settings as needed:

- upload_max_filesize

- post_max_size

- max_execution_time

- memory_limit

- max_input_vars

  1. 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

  1. Log in to DirectAdmin
  2. Navigate to Account Manager > Domain Setup
  3. Click on your domain name
  4. Look for the PHP Version Selector option
  5. Select your desired PHP version from the dropdown
  6. Click Save

Alternative Method: PHP Selector (CloudLinux)

If your server uses CloudLinux:

  1. Go to Extra Features > Select PHP Version (or PHP Selector)
  2. Choose the desired PHP version from the dropdown at the top
  3. Optionally, enable or disable PHP extensions
  4. Click Set as Current or Save

Per-Directory PHP Version

You can set different PHP versions for different directories:

  1. Go to PHP Selector
  2. Use the directory selector to choose the target directory
  3. Set the PHP version for that specific directory
  4. Subdirectories inherit the parent's PHP version unless overridden

Changing PHP Version in Plesk

  1. Log in to Plesk
  2. Go to Websites & Domains
  3. Click on PHP Settings (or PHP Version) for your domain
  4. Select the desired PHP version from the dropdown
  5. Optionally, choose the PHP handler:

- FPM application — best performance (recommended)

- FastCGI application — good compatibility

- CGI application — legacy support

  1. Click OK or Apply

Verifying Your PHP Version

After changing the version, verify it is active:

Method 1: phpinfo() File

  1. Create a file named phpinfo.php in your website root:
php
<?php
phpinfo();
  1. Visit https://yourdomain.com/phpinfo.php in your browser
  2. The page will display the current PHP version and configuration
  3. Delete this file immediately after checking — it exposes sensitive server information

Method 2: Check via SSH

bash
php -v

Note: The CLI PHP version may differ from the web PHP version.

Method 3: WordPress Dashboard

If running WordPress:

  1. Go to Tools > Site Health > Info
  2. Expand the Server section
  3. The PHP version is listed there

Configuring PHP Settings

After changing the PHP version, you may need to adjust settings:

Common PHP Settings

SettingDefaultRecommended for Most Sites
upload_max_filesize2M64M
post_max_size8M64M
max_execution_time30300
max_input_time60300
memory_limit128M256M
max_input_vars10005000

Adjusting Settings in cPanel

  1. Go to Software > MultiPHP INI Editor
  2. Select your domain
  3. Modify the desired values
  4. 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 256M

Adjusting 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 = 256M

Note: .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)

  1. Go to Software > Select PHP Version
  2. Click on Extensions
  3. Check or uncheck extensions as needed
  4. 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

ApplicationMinimum PHPRecommended PHP
WordPress 6.x7.48.1+
Joomla 5.x8.18.2+
Drupal 10.x8.18.2+
Laravel 11.x8.28.3+
Magento 2.4.x8.18.2+

Best Practices

  1. Test before switching: If possible, test your site with the new PHP version in a staging environment
  2. Update your software first: Update CMS, plugins, and themes before upgrading PHP
  3. Keep PHP current: Use the latest stable PHP version your application supports
  4. Monitor error logs: Watch for deprecation warnings that may become errors in future versions
  5. Back up first: Always create a backup before changing the PHP version
  6. Delete phpinfo.php: Remove any phpinfo files after checking — they are a security risk
  7. Review release notes: Check PHP release notes for breaking changes when upgrading major versions
  • 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}}.