Windows 10 PDOException with message 'could not find driver' Laravel 5.6.33 Wampserver 3.1.7 x86

本秂侑毒 提交于 2020-01-07 09:19:50

问题


I know there is a lot on this topic around StackOverflow, but my problem is that i have php extensions already uncommented, i have made the required changes to database.php and .env and i have declared and used the necessary environment path. The only thing i haven't done is install composer due to my proxy restrictions. I have a proxy that is over a kerberos windows AD, and for some reason nothing that used to work with proxy address, port and credentials (user and password) is working anymore, so i found this website to download php libraries and its dependencies without composerand managed to get Laravel 5.6.33 working or at least apparently, becouse when i tried to call: C:\wamp\www\laravel> php artisan migrate:install i got the following error :Illuminate\Database\QueryException : could not find driver (SQL: create table "migrations" ("id" serial primary key not null, "migration" varchar(255) not null, "batch" integer not null))and the following Exception trace: `Exception trace:

1 PDOException::("could not find driver") C:\wamp\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68

2 PDO::__construct("pgsql:host=localhost;dbname=tienda;port=5432", "postgres", "admin123", []) C:\wamp\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68`

I have to say that i am working on windows 10 Version 10.0.17134.1 64 bits and my wamp server is 3.1.7 with php 7.2.14

Any help or pointer on this issue will be appreciated


回答1:


After a lot of research and frustration, I thought on give it a try to xampp and what I found was that with xampp xampp-win32-7.3.0-0-VC15.exe installed, the correct extensions enabled in the php.ini

extension=pdo_pgsql
extension=pgsql

which in the xamp case is located at

C:\xampp\php

I set the path for xampp php in my Windows 10 Ent it is C:\xampp\php and later run the command

php C:\wamp\www\laravel> php artisan tinker

, after in the tinker console run

Psy Shell v0.9.9 (PHP 7.3.0 — cli) by Justin Hileman >>> DB::connection()->getPdo()

And I got what I was hoping for:

    => PDO {#2863
     inTransaction: false,
     attributes: {
       CASE: NATURAL,
       ERRMODE: EXCEPTION,
       PERSISTENT: false,
       DRIVER_NAME: "pgsql",
       SERVER_INFO: "PID: 1764; Client Encoding: UTF8; Is Superuser: on; Session Authorization: postgres; Date Style: ISO, MDY",
       ORACLE_NULLS: NATURAL,
       CLIENT_VERSION: "9.6.9",
       SERVER_VERSION: "9.6.11",
       STATEMENT_CLASS: [
         "PDOStatement",
       ],
       EMULATE_PREPARES: false,
       CONNECTION_STATUS: "Connection OK; waiting to send.",
       DEFAULT_FETCH_MODE: BOTH,
     },
   }

A response, which means that it found the driver that was always there and was able to use to access the database which was already installed and running.

The rest settings done in wamp with the virtual host and extensions enabled with the PHP version of 7.3.1 are the same and work like a charm.

I hope this may help others until the wamp and laravel teams find a way to make laravel

php artisan migrate

the command to work with wamp 3.1.7 for the x86 architecture alone.



来源:https://stackoverflow.com/questions/54580252/windows-10-pdoexception-with-message-could-not-find-driver-laravel-5-6-33-wamp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!