How to fix Fatal error: Class ‘PDO’ not found in PHP apps like Drupal, Prestashop, Joomla, etc
Other common causes of Fatal error: Class ‘PDO’ not found
As I mentioned earlier, this error is commonly caused by PHP settings mis-configuration. Here are a few scenarios we’ve seen:
The php.ini file missing extension=pdo.so
We’ve seen website owners overwriting fully function php.ini files with default configuration files that came with the Apache package. In such cases, the PHP configuration entry that ENABLES the PDO extension gets over-written.
To detect these issues, we look for the configuration entry “extension=pdo.so” in the active PHP configuration file. For instance, in the above example, we’d look for the “extension=pdo.so” in “/home/romrac/conf/php.ini“.
[ You don’t have to lose your sleep over PHP or MySQL errors in your websites. Get our professional help to fix your site for instantly. ]
PDO module not compiled or missing
In custom configured VPS servers, we’ve seen situations where PHP would not be compiled with a PDO extension, or the modules directory would be the PDO module file. To detect these issues, we look for the file “pdo.so” in the extensions directory, or look at the compiled modules list using the phpinfo() function.
For instance, in the above example, the PHP extensions directory was “/usr/lib/php5/20121212“. So, we’d in that server, we’d look for “pdo.so” in that directory.
[ Never let PHP errors affect your website functioning. Get our professional help to fix your website errors at affordable pricing. ]
Quick resolution of PHP errors
Modern servers use package management systems such as Yum or Apt to efficiently manage PHP configuration. However, customizing these settings for individual websites sometimes can lead to mis-configuration. Our help desk team traces these issues by following what we call “the flow of configuration“.
For example, when troubleshooting an issue in an Apache + mod-PHP server, our team would first check the Apache configuration file to make sure PHP is properly loaded.
Then the primary PHP configuration file (usually located in /etc) is checked to make sure all modules are loaded, the settings are correct, and if it allows user-level over-riding. Then the user’s PHP configuration file is checked to make sure settings are in sync with how the server is configured.
By following a well thought out troubleshooting process, our team is able to resolve such PHP issues within a few minutes, and thereby minimize website downtime.