How To Install and Enable PDO For cPanel, WHM

H

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:

About the author

Alvin Poh

I've over 17 years of entrepreneurship experience, having built a tech company to be the top in the country, which was subsequently acquired for an 8-figure sum. As CEO, I led the company through robust growth to 150 employees across 4 countries. After the acquisition, I embraced minimalism, sold off my personal possessions, and started living around the world.

Read more about my story here.

Add comment

By Alvin Poh

About Author

I've over 17 years of entrepreneurship experience, having built a tech company to be the top in the country, which was subsequently acquired for an 8-figure sum. As CEO, I led the company through robust growth to 150 employees across 4 countries. After the acquisition, I embraced minimalism, sold off my personal possessions, and started living around the world.

Read more about my story here.