Upgrade your site to a newer PHP version safely

Check compatibility, test the new PHP version on a staging subdomain, switch the live site and watch the error log.

TutorialIntermediate30 min to completeLast updated
On this page
  1. What you’ll need
  2. Step 1: Record the current version
  3. Step 2: Update the application
  4. Step 3: Set staging to the new version
  5. Step 4: Test staging and read its log
  6. Step 5: Fix or replace incompatible code
  7. Step 6: Switch the live domain
  8. Step 7: Watch the live error log
  9. Check it worked
  10. If something goes wrong
Level
Intermediate
Time
About 30 min
Steps
7
You’ll finish with
A working result, checked

7 steps

What you’ll need

  • DirectAdmin access
  • A backup
  • A staging copy of the site (optional but recommended)

Newer PHP is faster and supported, but old code can break. Testing first turns a risky change into a routine one.

Step 1: Record the current version

Check with Site Health or a phpinfo file. How to check which PHP version your site is using

Step 2: Update the application

Update your CMS, themes, plugins and Composer dependencies first.

Step 3: Set staging to the new version

On a staging subdomain (Using a subdomain as a staging site), open Account Manager › Domain Setup, select the subdomain and choose the new PHP version.

Step 4: Test staging and read its log

Click through key pages, log in, submit forms. Then read the error log for Fatal errors. How to find PHP errors (error logs and display_errors)

Step 5: Fix or replace incompatible code

Update or replace anything named in fatal errors. Deprecation notices can be noted for later. Choosing a PHP version: compatibility and support dates

Step 6: Switch the live domain

At a quiet time, change the live domain’s PHP version in Account Manager › Domain Setup. How to change the PHP version in DirectAdmin

Step 7: Watch the live error log

Test the same pages and check the error log for the next hour.

Check it worked

The live site runs on the new PHP version (confirmed in phpinfo or Site Health) with no new fatal errors in the log.

If something goes wrong

What happensWhat to do
Site breaks after switchingSwitch back immediately, then fix on staging.
phpinfo still shows the old versionYou checked a different domain folder, or a cached page.

New to Traxio? The PHP hosting page lists the PHP versions, database and tools every account gets.

Where this fits: DirectAdmin hosting explains the control panel every Traxio account uses, with a tour and tutorials.

Spotted something out of date or unclear? Tell us and we’ll fix it.

Keep going