Error "Uncaught Pdoexception: could not find driver" in Wordpress on localhost

Asked

Viewed 3,821 times

1

I’m trying to put a Wordpress site in Xampp (localhost) but when running it appears the following error:

My mistake: https://prnt.sc/gjytdc

Fatal error: Uncaught Pdoexception: could not find driver in C: xampp htdocs phdvital public_html panel include PDO pdopaginator.inc.php:16 Stack trace: #0 C: xampp htdocs phdvital public_html panel include PDO pdopaginator.inc.php(16): PDO->__Construct('mysql:host=loca...', 'root', '1234', NULL) #1 C: xampp htdocs phdvital public_html panel include class.connection.inc.php(30): Pdopaginator->__Construct('mysql:host=loca...', 'root', '1234') #2 C: xampp htdocs phdvital public_html global panel.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 panel include PDO pdopaginator.inc.php on line 16

Already enable extension_pdo, extension_mysql from php.init, I’m using extension_pdo PHP 7.1.8 and I’ve already given 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.

  • Which version of php do you use? looked at phpinfo() if mysql driver is included in the PDO part (it should be enabled)?

  • I’m using the version of PHP 5.6 and yes I already gave phpinfo and it works normally.

  • You could put the screenshot (in question) of the PDO part?

  • The module pdo_mysql is enabled? Probably on php.ini it will be necessary to uncomment the line extension=php_pdo.dll and extension=php_pdo_mysql.dll

  • yes the module is enabled.

  • You are not using PHP 5.6 but 7.18 according to the image you have provided. There is this line <IfModule php5_module> in the file httpd-xampp.conf? If so, then trade for php7.

  • It is true, but it is strange because it was pointing to the 5.6, but I believe that the following instructions are the same?

  • You’re probably editing the php.iniwrong. What is the result of phpinfo(INFO_GENERAL); ? Can you post the image? Try to put the image in Stackoverflow itself ( recommended ) because external servers may crash and the question loses that link, you set the migration from PHP 5 to 7?

  • In my httpd-xampp.conf doesn’t have the <IfModule php5_module ( my archive: [https://prnt.sc/gjz0zz] | [https://prnt.sc/gjz169] | [https://prnt.sc/gjz1d1] and mine phpinfo(INFO_GENERAL) [https://prnt.sc/gjz1z3]

  • Are you changing the php.ini that’s in the folder C:\xamp\php\php.ini as is in the phpinfo? Apparently by the images there is nothing wrong. I believe the problem is in the configuration of Mysql. As it is a separate installation, the Mysql service is working?

  • I am using a mysql already installed on the machine before Xampp.

Show 7 more comments

1 answer

7


Open php.ini (and not httpd-xampp.conf), Xampp php.ini must be in a folder similar to this C:\xampp\php\php.ini, on windows native Notepad may not open properly, can open by programs like Sublimetext or Notepad++.

After opening, locate the lines containing:

;extension=php_pdo.dll

and

;extension=php_pdo_mysql.dll

Take off 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 the ; and getting:

extension=pdo_mysql

And then hail the file/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:

imagem ilustrativa de uma versão antiga do Xampp

  • I already took the ; php.ini’s error still persists.

  • He has already done all this. The problem is that Mysql is an installation part of Xampp, I believe the problem is there.

  • I am not using the mysql of xampp.

  • @Did William restart Apache? If yes create an empty php file called test.php and then add inside it this <?php phpinfo();, save and run this in the browser http://localhost/teste.php, take a screen of the result and send me (have browser plugins that do this).

  • @William this error has nothing to do with mysql. Continue as I said

  • @Filipemoraes if the problem is in mysql then the error message should have changed, if the message continues is because the php_pdo_mysql, if the message is different from what is in the question it should inform in the body of the question so I have a parameter of what may be the problem.

  • My phpinfo() https://prnt.sc/gjz90o

  • Yes, but the information you are requesting is all in the comments of the question, I’ve asked for it but I can’t find the problem. View the comments of the question.

  • @William vc took photo of the screen, I want the photo of the whole page, the plugin light itself does it, selects the option "Whole page" or "entire page".

  • @Filipemoraes has nothing there, only this speaking of httpd.conf, and this is about Apache, I saw no comment that said that changed the error message.

  • @William the error message is still could not find driver?

  • Yes that’s the message.

  • @William then either you have not edited the file correctly or you have not restarted Apache properly. At phpinfo, take the full page print like I told you to make sure.

  • @William if using Chrome install this https://chrome.google.com/webstore/detail/full-page-screenshot/glgomjpomoahpeekneidkinhcfjnnhmb and take a screen of the page for me please.

Show 9 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.