This article is intended for customers running Drupal 7 who encounter a PDOException or similar database error after a recent update or server change.
Problem
After updating Drupal or making changes to your server, you may see an error like:
Cause
This error is usually not a direct database problem, but is caused by incompatibility between Drupal 7 and PHP 7.4. Recent Drupal core updates and the end of life for PHP 7.4 have resulted in issues when running Drupal 7 sites on this version of PHP.
-
PHP 7.4 is no longer supported (end of life: November 2022).
-
Drupal 7 requires PHP 8.1 or newer for reliable operation (minimum recommended: PHP 8.1; PHP 8.2/8.3 supported as of Drupal 7.94/7.103).
-
Drupal 7 itself reached end of life on 5 January 2025 and no longer receives official security updates.
Solution
Step 1: Update Drupal Core, Modules, and Themes
Update your Drupal 7 website to the latest version (7.103), and update all contributed modules and themes to their latest releases. This ensures compatibility with newer PHP versions and improves site security.
Step 2: Change PHP Version in cPanel
Switch your hosting account to PHP 8.1 or newer (preferably PHP 8.2 or 8.3).
You can change the PHP version in cPanel on the “Select PHP Version” page. See:
Step 3: Check Compatibility for Multiple Sites
If you host multiple sites on the same account, check that each site is compatible with the new PHP version, ideally before making the switch.
Step 4: Plan for Upgrade or Rebuild
As Drupal 7 is now "end of life", we strongly recommend planning to upgrade to a supported version of Drupal (such as Drupal 10 or 11) or considering a rebuild if upgrading is not possible.
Further Information
Updated by SP on 26/06/2025