How to Check if PDO is enabled in my PHP on Apache Installation? CodeUnit 13 DEC 2012

PDO is a popular way of managing database connections and activities in the LAMP stack, though it isn’t always turned on by default unfortunately.

Lucky for us, the following simple PHP code snippet runs a simple enough check and then alerts us to the status, making it a breeze to pick up on whether of not PDO is actually available or not.

if (!defined('PDO::ATTR_DRIVER_NAME')) {
echo 'PDO unavailable';
elseif (defined('PDO::ATTR_DRIVER_NAME')) {
echo 'PDO available';

Simple but rather effective.

Related Posts:

About Craig Lotter

South African software architect and developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.

  • iamatomix

    it’s a good way, Thank you.