Skip to content

How To Install and Enable PDO For cPanel, WHM

PHP Data Objects ( PDO ) is a PHP extension that provides a consistent way of interacting with databases. To use PDO, you’ll need PHP 5, and PDO has to be installed and enabled, or you’ll get an error like this: “Fatal error: Class ‘PDO’ not found in…”

To check whether PDO is even installed, run this code on your server:

if ( extension_loaded(‘pdo’) ) {
echo “PDO is installed.”;
} else {
echo “PDO is NOT installed.”;
}

To install PDO in WHM servers, you’ll need a SSH terminal. Then, run the following 2 lines:

pecl install pdo
pecl install pdo_mysql

Once installed, you might need to add the following in a php.ini file in your web hosting account:

extension=pdo.so
extension=pdo_mysql.so

That’s it.

Leave a Reply

Your email address will not be published. Required fields are marked *