PDOException “could not find driver”
You need to have a module called pdo_mysql. Looking for following in phpinfo(),
pdo_mysql
PDO Driver for MySQL, client library version => 5.1.44
Laravel: PDOException: could not find driver
You might need to comment out the following in your php.ini file.
;extension=pdo_mysql.so
Taken from this post:
Laravel 5 PDOException Could Not Find Driver
. I think I had to do something exactly like this when setting up laravel on digital ocean.
PHP Fatal error: Uncaught PDOException: could not find driver
To use different drivers you need to install them.
On Windows you simply uncomment a line in php.ini:
extension=php_pdo_mysql.dll
On Debian or similar Linux distribution you can just install the extension with the package manager:
sudo apt update
sudo apt install php7.1-mysql
Remember to install the correct version.
php - PDOException could not find driver
Remove the ;
from before the ;extension=php_pdo.dll
. And also from before other pdo
extensions. If you want to use those. And then restart the server.
The ;
actually comments a line in ini
files. So, you have to un-comment those lines to use them.
Edit: Instead of going through all of this trouble, you can instead use Xampp
or Wamp
or EasyPHP
or something.
Laravel 5 PDOException Could Not Find Driver
You should install PDO on your server.
Edit your php.ini (look at your phpinfo()
, "Loaded Configuration File" line, to find the php.ini file path).
Find and uncomment the following line (remove the ;
character):
;extension=pdo_mysql.so
Then, restart your Apache server.
For more information, please read the documentation.
Fatal error: Uncaught PDOException: could not find driver in
Edit answer : its because of the whitespace, \r\n \t\t\t is not a pdo driver
PDOException::(could not find driver) PHP Configuration MySql
Finally was able to figure it out my self. While changing configuration in php.ini file which is in xampp folder I also modified the file in php installed location .ini file. reverting back the changes worked.
Laravel: Error [PDOException]: Could not Find Driver in PostgreSQL
Be sure to configure the 'default'
key in app/config/database.php
For postgres, this would be 'default' => 'postgres',
If you are receiving a [PDOException] could not find driver
error, check to see if you have the correct PHP extensions installed. You need pdo_pgsql.so
and pgsql.so
installed and enabled. Instructions on how to do this vary between operating systems.
For Windows, the pgsql
extensions should come pre-downloaded with the official PHP distribution. Just edit your php.ini
and uncomment the lines extension=pdo_pgsql.so
and extension=pgsql.so
Also, in php.ini
, make sure extension_dir
is set to the proper directory. It should be a folder called extensions
or ext
or similar inside your PHP install directory.
Finally, copy libpq.dll
from C:\wamp\bin\php\php5.*\
into C:\wamp\bin\apache*\bin
and restart all services through the WampServer interface.
If you still get the exception, you may need to add the postgres \bin
directory to your PATH
:
- System Properties -> Advanced tab -> Environment Variables
- In 'System variables' group on lower half of window, scroll through and find the
PATH
entry. - Select it and click Edit
- At the end of the existing entry, put the full path to your postgres bin directory. The bin folder should be located in the root of your postgres installation directory.
- Restart any open command prompts, or to be certain, restart your computer.
This should hopefully resolve any problems. For more information see:
- http://php.net/manual/en/install.pecl.windows.php
- http://webcheatsheet.com/php/install_and_configure.php#extsetup
Related Topics
Php How to Determine the First and Last Iteration in a Foreach Loop
Calculate Size in Bytes of Json Payload Including It in the Json Payload in PHP
How to Change Value of Select Options Based on Another Select Option Selected
Chrome Net::Err_Incomplete_Chunked_Encoding Error
Comparing Date from Variable to MySQL Date
Detect a Quotation in a String
How to Count Columns With the Same Value in a Specific Row in MySQL
Turning Query Errors to Exceptions in MySQLi
Warning: Preg_Replace(): Unknown Modifier
Project Links Do Not Work on Wamp Server
MySQLi or Pdo - What Are the Pros and Cons
PHP Multidimensional Array Search by Value
Send Attachments With PHP Mail()
How to Check If a String Contains a Specific Word
Why Would One Omit the Close Tag