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.