Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tarif_haque's avatar

How to install pdo_mysql to /usr/local/lib/php/pecl/20190902/ ?

Hi, I'm just started learning PHP. And I am using the built-in HTTP server on Mac (Monterey 12.4 & PHP Version 7.4.29).

When trying to connect with the MySQL database with PDO it shows:

could not find driver

I uncommented this line on the php.ini extension=pdo_mysql

But now the server shows:

PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/local/lib/php/pecl/20190902/pdo_mysql (dlopen(/usr/local/lib/php/pecl/20190902/pdo_mysql, 0x0009): tried: '/usr/local/lib/php/pecl/20190902/pdo_mysql' (no such file)), /usr/local/lib/php/pecl/20190902/pdo_mysql.so (dlopen(/usr/local/lib/php/pecl/20190902/pdo_mysql.so, 0x0009): tried: '/usr/local/lib/php/pecl/20190902/pdo_mysql.so' (no such file))) in Unknown on line 0

My understanding is (please correct me if I'm wrong) pdo_mysql is not installed in the PHP extension directory /usr/local/lib/php/pecl/20190902/

Is it possible to check if pdo_mysql is installed in any other directory?

Please let me know how I can solve it and make pdo_mysql work properly.

0 likes
4 replies
jlrdw's avatar

Usually uncomment it in php.ini.

tarif_haque's avatar

@jlrdw Already did it but the problem is pdo_mysql is not installed in the extension directory. And now the question is how to install it there?

Please or to participate in this conversation.