How to Change PHP Versions in DirectAdmin

Categories: DirectAdmin

Changing the PHP version of your hosting environment can help improve compatibility, security, and performance for your website. DirectAdmin provides an easy way to manage PHP versions, allowing you to switch between versions to ensure compatibility with your website’s scripts and applications. Here’s a step-by-step guide on how to change PHP versions in DirectAdmin.


1. Log In to DirectAdmin

To get started, log in to your DirectAdmin control panel with your credentials. You’ll need to access the Account Manager or Advanced Features, depending on your DirectAdmin interface setup.


2. Navigate to PHP Version Selector

DirectAdmin may have different ways to access the PHP version settings, depending on your hosting setup and the control panel configuration. Look for one of these options:

  • Option 1: System Info & Files:
    • Go to System Info & Files > Select PHP Version.
  • Option 2: Domain Setup:
    • Go to Account Manager > Domain Setup.
    • Select the domain you wish to change the PHP version for.

If neither of these options is visible, check with your hosting provider, as they may have restricted access to PHP version selection.


3. Select the Domain to Change PHP Version

If you’re using Domain Setup, you’ll see a list of all the domains associated with your account. Choose the specific domain for which you want to change the PHP version by clicking on it.


4. Choose the Desired PHP Version

Once you’re in the PHP Version Selector or Domain Setup, you’ll see a drop-down menu with the available PHP versions. Select the version you need for your website:

  • Available PHP Versions: DirectAdmin usually offers a range of PHP versions, from older versions (e.g., PHP 5.6) to the latest stable releases (e.g., PHP 8.1 or PHP 8.2).
  • Compatibility Consideration: Choose a PHP version compatible with your website’s code. Newer versions provide better performance and security, but certain older applications may not support the latest versions.

Tip: If you’re unsure which PHP version your website supports, check your CMS or application’s documentation for compatibility details.


5. Save the Changes

After selecting the desired PHP version, click Save or Update to apply the change. DirectAdmin will process the update, and your domain will start running on the new PHP version.

Note: Changes usually take effect immediately, but in some cases, they may take a few minutes.


6. Verify PHP Version on Your Website

To ensure the PHP version change was successful, you can verify the version running on your website. Here’s how:

  • Option 1: PHP Info Script:

    1. Create a new file named phpinfo.php in your website’s root directory (e.g., public_html).
    2. Open the file and add the following code:
      
       

      <?php phpinfo(); ?>

    3. Save the file and access it in your browser by visiting http://yourdomain.com/phpinfo.php.
    4. Look for the PHP version displayed at the top of the page.
  • Option 2: CMS or Application Dashboard:

    • Some CMS platforms, like WordPress, display the PHP version within the dashboard under system or site health settings.

Tip: After verifying, delete the phpinfo.php file from your server to prevent exposing server details.


7. Test Your Website for Compatibility Issues

Once the PHP version change is complete, check your website for any compatibility issues, especially if you updated to a significantly newer version. Some plugins, themes, or scripts may require updates to work correctly with newer PHP versions.

  • Check Key Website Functions: Test forms, plugins, logins, and other essential features to ensure everything works as expected.
  • Error Logs: If your website isn’t working correctly, review error logs in System Info & Files > Log Viewer to identify any compatibility issues.

Tip: If you experience issues, try downgrading to the previous PHP version or updating incompatible plugins and scripts.


Final Thoughts

DirectAdmin’s PHP version selector makes it simple to change PHP versions for individual domains, allowing you to optimize your website’s performance and security. By following these steps, you can easily switch PHP versions to meet your website’s needs. Regularly updating to the latest compatible PHP version can improve your site’s speed, security, and functionality, giving your visitors a better experience.