Drupal] How to solve fatal error with Class 'PDO' in Drupal sites?

By | 10th Dec 2012 | 1 min read

We have been facing the error message "Fatal error: Class 'PDO' not found in includes/database/database.inc on line 184" in one of our Drupal sites. Googling up the error text had brought out a number of solutions which did not help to resolve the error in our case as there is no single cause of the error. However we managed to solve it using a different method. If you are facing the same scenario in your Drupal site and want to know how to solve fatal error with Class 'PDO' in Drupal sites the continue reading for the solution.

This is how we fixed the error

  1. We traced the source of the error message to the custom php.ini file in the root folder of our Drupal site
  2. Removing the custom php.ini file from the root folder solved the issue.
  3. Just take care of the following things when you attempt this fix in your site
    1. If your site is in public_html you can remove or rename the php.ini file.
    2. If your site is in a subfolder like public_html/beta do the same process or copy php.ini from beta that to root folder.

This fix solved the issue for us. Hope it helps you too