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.

Similar Posts:

Leave a reply:

Your email address will not be published.

*

Site Footer

Sliding Sidebar

Disclaimer

The contents on this blog are not intended as professional advice. The author disclaims any liability, loss, or risk taken by individuals who directly or indirectly act on the information contained on this blog.