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

HussainAwaisSajjad's avatar

problem in connecting php and mysql

whenever i want to connect php with mysql localhost gives this following error : "Fatal error: Uncaught PDOException: could not find driver in C:\Users\Pc\webpage\demo\index.php:12 Stack trace: #0 C:\Users\Pc\webpage\demo\index.php(12): PDO->__construct('mysql:host=loca...') #1 {main} thrown in C:\Users\Pc\webpage\demo\index.php on line 12"

0 likes
3 replies
jlrdw's avatar

Uncomment it in php.ini and restart the server.

extension=pdo_mysql

jlrdw's avatar

@HussainAwaisSajjad you did restart the server?

Format code and show index.php here. And your connection details, star password.

3 backticks

code

3 backticks

Does phpmyadmin work?

Please or to participate in this conversation.