close

[Solved] PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’

I am trying to check the PHP version but I am facing the following warning message: PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’ in PHP. In this Exerror article, We are going to learn about How to reproduce this error and we will discuss All Possible Solutions Lets Get Start with This Article.

How PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’ Error Occurs?

I am trying to check the PHP version but I am facing the following warning message.

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql.so'

So here I am writing all the possible solutions that I have tried to resolve this error.

How To Solve PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’ Error?

  1. How To Solve PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’ Error?

    To Solve PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’ Error First of all Open your php.ini file which should be located at /etc/php/7.4/cli/php.ini whichever PHP version you are using. If you are using 7.2 then your PHP in file path should be here /etc/php/7.2/cli/php.ini. Open php.ini file and find extension=pdo_mysql which should be located at line number 906. Just uncomment ;extension=pdo_mysql by removing ; Just like This: extension=pdo_mysql And now Restart your PHP Services by running this command: sudo systemctl restart php7.4-fpm Now, Your error will be solved.

  2. PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’

    To Solve PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’ Error You just need to install php-mysql again and your error will be solved. First of all Uninstall php-common from your server. To completely uninstall php-common Just run sudo command with –purge remove just like this: sudo apt-get –purge remove php-common And then you need to install php-common, php-mysql and php-cli You can run all these by running this one command in your terminal: sudo apt-get install php-common php-mysql php-cli And now, Your error will be solved successfully. Thank you.

Solution 1: install php-mysql

To Solve PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’ Error You just need to install php-mysql again and your error will be solved. First of all Uninstall php-common from your server. To completely uninstall php-common Just run sudo command with –purge remove just like this.

sudo apt-get --purge remove php-common

And then you need to install php-common, php-mysql and php-cli You can run all these by running this one command in your terminal.

sudo apt-get install php-common php-mysql php-cli

And now, Your error will be solved successfully. Thank you.

Solution 2: Change php.ini

First of all Open your php.ini file which should be located at /etc/php/7.4/cli/php.ini whichever PHP version you are using. If you are using 7.2 then your PHP in file path should be here /etc/php/7.2/cli/php.ini. Open php.ini file and find extension=pdo_mysql which should be located at line number 906. Just uncomment ;extension=pdo_mysql by removing ; Just like This.

extension=pdo_mysql

And now Restart your PHP Services by running this command.

sudo systemctl restart php7.4-fpm

Now, Your error will be solved.

Conclusion

It’s all About this error. I hope We Have solved Your error. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment