How to resolve “Fatal error: Class ‘PDO’ not found in /home/public_html/…/includes/database/database.inc on line 184” error in Drupal?

PDO (PHP Data Objects) is a thin data access layer and provides consistent way to access databases. Drupal uses PDO to interact with its databases. If the PDO is not enabled or PDO related libraries are not included you will get “Fatal error: Class ‘PDO’ not found in /home/public_html/…/includes/database/database.inc on line 184” error in Drupal.

Below are the steps required to fix the above issue.

Step (1). Enable PDO in your php.ini file. php.ini file is located into the root folder where you installed your Drupal based website.

Step (2). Log-in into your website’s control panel.

Step (3). Open php.ini file. As mentioned above, it will be in root folder where you installed your web-site. For eg: in Linux hosting, it will be in /home/public_html folder.

Step (4). Check for the following lines in php.ini file are commented. If they are commented, means prefixed with semi-colon(“;”), remove the semi-colon from each line. If you are using sqlite instead of mysql, you can comment mysql related line.

extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so

Step (5). Once you made your changes in php.ini file save the changes and refresh your page.

Step (6). If still you are getting the same error, it might be the corrupted version of your php.ini file. Backup you php.ini file and replace with any of the working php.ini file.

Step (7). Again do Step (4) and refresh your website.

If no errors in your php.ini file, your website will be visible without any errors.

by Code Steps

Leave a Reply