. Advertisement .
..3..
. Advertisement .
..4..
Have you ever encountered a warning message: “PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’” in PHP when you were trying to check the version? If your answer is yes then keep reading this article because it will help you to solve this error. We’ll start with how this error happens.
How Does The Error “PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’” Happen?
PHP stands for Hypertext Preprocessor, a widely-used open source general-purpose scripting language that is especially appropriate for web development and can be embedded into HTML.
The error message below appears when we try to get our php to be checked, right?
PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’
So here are some solutions that you can try to remove that error.
How “PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’” Error Can Be Solved?
In this article, we bring to you 2 solutions to solve this error.
Method 1: Change php.ini
You can fix the error “PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so'” by changing php.ini. The first thing you need to do is to open the php.ini file. The php.ini file is defined as a special file for php, where you confirm changes to your php settings. Your site will use by default because the server is already configured with standard settings for php. And there is not necessary to produce or modify a php.ini file in case you need to change one or more settings.
/etc/php/7.4/cli/php.ini or some other versions should be where the hp.ini file is placed. The file path in your php should be at /etc/php/7.2/cli/php.ini if you are using 7.2. After opening the php.ini file, you look for extension=pdo_mysql. Extension=pdo_mysql should lie in line number 906. Then uncomment;extension=pdo_mysql just by removing:
extension=pdo_mysql
Now you run the following command to get your php services restarted.
sudo systemctl restart php7
Now you can completely solve the error. Good luck!
Method 2: Install php-mysql
Besides changing php.ini you can try installing php-mysql.
The error “PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so'” can be fixed by installing php-mysql. Before installing php-common, the-mysql from your server needs to be uninstalled. Php-common can only be uninstalled completely when you run the sudo command with –purge remove just like the following command:
sudo apt-get –purge remove php-common
After uninstalling php-common the next step is to install php-common, php-mysql, and php-cli. You just need to use the following command to run php-common, php-mysql, and php-cli.
sudo apt-get install PHPcommon php-mysql php-cli
This second solution can also help you to solve the error “PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’” thoroughly.
Conclusion
Thank you for taking the time to read the article. Hope it can help you to fix the error “PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’”. If you have any questions or thoughts about our article, please write them down in the comment section. And of course, let us know which solution works best for you. Good luck!
Read more:
Leave a comment