For anyone coming along later, like I did, and seeing this...
I was receiving the same error because I did not have the extension "enabled" in my php.ini file. I would imagine you might also get this error if you have recently upgraded your php version and did not properly update your php.ini file.
If you are receiving this error shortly after upgrading your php version, the info below might help you out:
PHP 7.4 slightly changed its syntax in the php.ini file.
Now, to enable the mysql pdo, make sure extension=pdo_mysql
is uncommented in your php.ini file. (line 931 in the default php.ini setup)
The line used to be:
extension=php_pdo_mysql.dll on Windows
extension=php_pdo_mysql.so on Linux/Mac
as Sk8erPeter pointed out. but the .dll and .so endings are to be deprecated and so it is best practice to begin getting rid of those endings and using just extension=<ext>
The below is pulled from the default php.ini-production file from the php 7.4 zip download under "Dynamic Extensions":
Note : The syntax used in previous PHP versions ('extension=.so' and 'extension='php_.dll') is supported for legacy reasons and may be deprecated in a future PHP major version. So, when it is possible, please move to the new (extension=<ext>
) syntax.