Installing PDO_MYSQL PHP extension on CPanel?

Installing PDO_MYSQL PHP extension on CPanel?

September 1, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Installing PDO_MYSQL PHP extension on CPanel?

Resolving “PHP Extension ‘pdo_mysql’ Must Be Loaded” Error on CPanel

If you’re encountering the error 'PHP Extension "pdo_mysql" must be loaded' while installing Magento or other PHP applications that require PDO_MYSQL support, it’s likely due to the extension not being enabled. In this guide, we’ll walk through the steps to enable the PDO_MYSQL extension on a CPanel server.

Understanding the PDO_MYSQL Extension

The PDO (PHP Data Objects) extension provides a uniform interface for accessing databases in PHP. The PDO_MYSQL driver allows interaction with MySQL databases using PDO objects. If this extension is not enabled, your application won’t be able to connect to or interact with MySQL databases.

Steps to Enable PDO_MYSQL on CPanel

Step 1: Access the MultiPHP INI Editor

Log in to your CPanel account and navigate to the “MultiPHP INI Editor” section under the “Advanced” tab. Click on it to open the editor.

MultiPHP INI Editor

Step 2: Select Your PHP Version

In the “Select PHP version for the domain” drop-down, choose the PHP version you’re using for your application (usually the one listed at the top). Click on it to proceed.

Step 3: Locate and Enable PDO_MYSQL

Scroll down until you see a section labeled “Additional .ini files.” Look for a line starting with extension=pdo_mysql. If this line is commented out or missing, you’ll need to add it.

If the line is already there but prefixed with a semicolon (;), simply remove the semicolon to uncomment the extension. This enables PDO_MYSQL.

;extension=pdo_mysql

Becomes:

extension=pdo_mysql

Step 4: Save Your Changes

Click on the “Apply” button at the bottom of the page to save your changes.

Verifying the Extension is Enabled

To confirm that the PDO_MYSQL extension has been enabled, you can check the PHPinfo file or use a simple PHP script. Here’s how:

Method 1: Using PHPinfo File

Create a new file named phpinfo.php in your domain’s document root (usually /home/yourusername/public_html). In this file, add the following line:

<?php phpinfo(); ?>

Save it and open your web browser. Navigate to http://yourdomain.com/phpinfo.php. Look for “PDO drivers” in the output; you should see a section titled “pdo_mysql”.

Method 2: Testing with PHP Script

Create another file named test_pdo.php and add the following code:

<?php
try {
    $dbh = new PDO('mysql:host=localhost;dbname=your_database_name', 'username', 'password');
    echo "PDO_MYSQL is enabled";
} catch (PDOException $e) {
    echo "Error: " . $e->getMessage();
}
?>

Replace your_database_name, username, and password with your actual database credentials.

Save the file and open it in your web browser. If PDO_MYSQL is enabled, you should see the message “PDO_MYSQL is enabled.”

If you still encounter issues or if this guide doesn’t apply to your specific situation, I recommend reaching out to our support team at LaravelCompany for further assistance.

Conclusion

Enabling the PDO_MYSQL extension on a CPanel server is straightforward. By following these steps and verifying your configuration, you should be able to resolve the 'PHP Extension "pdo_mysql" must be loaded' error and proceed with your application installation or development.

Remember to always backup important data before making changes to your PHP settings. If you’re unsure about any aspect of this process, don’t hesitate to consult our knowledge base for more detailed guides or contact us directly for personalized assistance.

Happy coding!

Database Extensions Customers Errors

Our network