I tried installing the useful open-source invoice management web application Siwapp the other day, and on trying to run the install script I kept getting shot down with a “Fatal error: Class ‘PDO’ not found in…” error message.

Some time spent on Google informed me that the problem lies in the fact that the popular PDO database handling extensions weren’t installed properly on my web server, despite PHP info telling me explicitly that the version of PHP which the server was running was compiled with PDO support.

Anyway, after some digging around on the ‘Net, I found the quick way of solving this issue, pretty much through adding some lines to your existing php.ini configuration file.

So, after opening up the relevant php.ini file via my server’s cPanel installation, I added the following lines to the bottom of the file, in the extensions section of the .ini file:

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

Obviously, you don’t have to add all the database types if say your application only uses MySQL.

You might have to restart your webserver, though this is doubtful, and as long as your version of PHP has been compiled to support PDO, you should now be free of the dreaded “Fatal error: Class ‘PDO’ not found in…” message. (phpinfo should give you some more information about what PDO functionality you now have access to).

Nifty.