Change the PHP version of a site

 

Overview

You can change the PHP version of a site at any time, using either the panel or an .htaccess file.

DreamHost offers several versions of PHP, including unsupported, end-of-life versions. When you add a site, you can choose which version to use, and you can change this version — including switching to an unsupported version — at any time in the panel.

Prerequisites

Your domain must be Fully Hosted on a server to change the PHP version. DNS Only, Parked, and Redirect domains do not have PHP options.

How do I change the PHP version?

The following sections explain how to change the PHP version in either the panel or an .htaccess file.

For VPS users running Nginx, PHP is managed at the server level and must be changed on the Server & Users dashboard page instead of the Manage Websites page. For additional details, see this article.

How do I change the PHP version in the panel?

To change the PHP version on any of your domains/subdomains within the panel:

  1. Navigate to the Manage Websites page.
  2. Click the Manage button to open Website settings, which allows you to modify various configurations for your site.
    • If in Grid view, click the Manage button at the bottom of the website box.
    • If in List view, click the Manage button at the far right of your domain name.
  3. Click the Settings tab.
  4. In the Website Settings section, click the Manage button next to PHP.

    The PHP Settings page opens.
  5. Scroll down to the PHP Version section.
  6. Choose a version of PHP from the dropdown menu.

    The dropdown includes unsupported, end-of-life PHP versions.
  7. Click the Change PHP Version button.

    The following two options appear:

    • Revert to previous PHP version — Reverts to a previous version, which allows you to resolve any issues at a later time without causing site errors (recommended).
    • Change PHP version anyway! — Changes the PHP version, which may cause compatibility errors on your website (not recommended).
  8. Select one of these options to control what happens if the upgrade fails.
  9. Click the Change PHP Version button.

    The update takes less than 5 minutes. When complete, a success message appears.

Selecting an unsupported PHP version may add PHP Extended Support charges to the account. Previously, switching to an unsupported version required contacting support; you can now select it directly from this dropdown. Contacting support to apply an unsupported version remains available as a fallback option.

If an error occurs

The following error message appears if your website's code is not compatible with the new PHP version you have selected:

PHP Change Unsuccessful. example.com has been reverted back to PHP version x.x.

If you selected Revert to previous PHP version, the PHP version is not changed. You can then use the instructions in this article to locate and update the incompatible code before attempting to change the PHP version again.

How do I change the PHP version on my site using an .htaccess file?

Be cautious when using this method over long periods of time. If you use an .htaccess file to force a version that has reached its End of Life (EOL), your site may experience issues when that version is removed from the server. Additionally, continued use of an older PHP version after it's been EOLed may be subject to PHP Extended Support charges.

To change the PHP settings using an .htaccess file:

  1. View the following articles for instructions on how to create or edit your .htaccess file:
  2. Add the following two lines in your .htaccess file, which forces PHP to use PHP 8.4:

    AddHandler fcgid-script .php 
    FCGIWrapper "/dh/cgi-system/php84.cgi" .php
  3. If this causes any problems, remove the lines to switch back to your previous settings.

Making this change also adjusts the PHP version displayed in your panel on the Manage Websites page. However, it may take up to 24 hours for it to update.

FAQs

Can I select an unsupported version of PHP in the panel?

Yes. The PHP Settings dropdown includes unsupported, end-of-life PHP versions. Selecting one may add PHP Extended Support charges to the account. Contacting support to apply an unsupported version remains available as a fallback option.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?