Error "Uncaught PDOException: could not find driver" in Wordpress on localhost
I am trying to put a Wordpress site in XAMPP (localhost) but when running it appears the following error:
My error: https://prnt.sc/gjytdc
Fatal error: Uncaught PDOException: could not find driver in C:\xampp\htdocs\phdvital\public_html\painel\include\PDO\pdopaginator.inc.php:16 Stack trace: # 0 C:\xampp\htdocs\phdvital\public_html\painel\include\PDO\pdopaginator.inc.php(16): PDO-> _ _ construct ('mysql:host=loca...', 'root',' 1234', NULL) #1 C:\xampp\htdocs\phdvital\public_html\painel\include\class.connection.inc.php(30): PDOPaginator-> _ _ construct ('mysql: host = loca...', 'root', '1234') #2 C:\xampp\htdocs\phdvital\public_html\painel\global.php(35): connection- > connect () #3 C:\xampp\htdocs\phdvital\public_html\index.php(17): require('C:\xampp\htdocs...') #4 {main} thrown in C:\xampp\htdocs\phdvital\public_html\painel\include\PDO\pdopaginator.inc.php on line 16
Already enable extension_pdo, extension_mysql from php.init, I'm using the PHP 7.1.8 and tabém I gave the phpinfo and it worked normally.
My phpinfo: https://prnt.sc/gjysdn https://prnt.sc/gjyt77
Note: my xampp is not installed Mysql because it is installed the part.
1 answers
Open php.ini ( and not the httpd-xampp.conf), or php.ini of Xampp should be in a folder similar to this C:\xampp\php\php.ini
, in Windows native notepad may not open properly, it can open by programs like SublimeText or notepad++.
After opening, locate the lines that contain:
;extension=php_pdo.dll
And
;extension=php_pdo_mysql.dll
Remove the ;
and from the front, getting:
extension=php_pdo.dll
And
extension=php_pdo_mysql.dll
If it is PHP7 (both Windows and Linux) it should look like this:
;extension=pdo_mysql
Remove o; and getting:
extension=pdo_mysql
And then Save the file by pressing Ctrl + S, then it is necessary restart the Apache (in case you should do this in the XAMPP panel), press the Stop button and after it turns Start press again: