PDOException “could not find driver”

Asked
Active3 hr before
Viewed126 times

7 Answers

90%

As you can see above, the modules are installed on a file path not known or guided by common library path: /usr/lib/php5/20090626/. For your installation, it may be different, but only the path of pdo_mysql.so, pdo.so, mysqli.so. So, this is why Drupal or any other php engine couldn't find the library and shows that error: PDOException: could not find driver,I have just installed Debian Lenny with Apache, MySQL, and PHP and I am receiving a PDOException could not find driver., 3 To whom it may concern: if you are using php 7.1+ on docker, you can docker exec into the container and run docker-php-ext-install pdo pdo_mysql. – cleybertandre Jun 9 '19 at 18:35 ,I struggled and struggled with "apt install php-mysql php7toInfinity and don't forget sqlite-what-ever's" and just could not get rid of this error message until I went back to basics and reset the file-permissions on the web-site in question.

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
load more v
88%

I have just installed Debian Lenny with Apache, MySQL, and PHP and I am receiving an error:, Error PDOException could not find driver ,84858/error-pdoexception-could-not-find-driver,DB_HOST, DB_NAME, DB_USER, and DB_PASS are constants that I have defined. It works fine on the production server (and on my previous Ubuntu Server setup).

I have just installed Debian Lenny with Apache, MySQL, and PHP and I am receiving an error:

PDOException could not find driver

This is the specific line of code:

$dbh = new PDO('mysql:host='.DB_HOST.
   ';dbname='.DB_NAME, DB_USER, DB_PASS)
load more v
72%

Fatal error: Uncaught PDOException: could not find driver in /home/project/public_html/api/v1/database-singleton.php:36 Stack trace: ,#4 {main} thrown in /home/project/public_html/api/v1/database-singleton.php on line 36,#1 /home/project/public_html/api/v1/database-singleton.php(41): DB::instance() ,#3 /home/project/public_html/api/v1/all-notifications-v2.php(1426): getAllUserNotification('4')

line 35 $dsn = 'mysql:host='.DB_HOST.
';dbname='.DB_NAME.
';charset='.DB_CHAR;
line 36 self::$instance = new PDO($dsn, DB_USER, DB_PASS, $opt);
load more v
65%

PDOException “could not find driver”,The reason may be not activated pdo_mysql or not installed php5-mysql. Let’s look at the PDO:,Let’s see the information about php5-mysql:,If not installed, then install, in Ubuntu it can be done like this:

php - i | grep PDO
load more v
75%

To use different drivers you need to install them. On Windows you simply uncomment a line in php.ini:,On Linux you install the extension with the package manager:,Then I have uncommented and changed the extension directory to the full installation path.,Then run that script from the command line. If you don't get the 'could not find driver' error message, then that points to an incompatibility between your PHP and Apache versions.

To use different drivers you need to install them. On Windows you simply uncomment a line in php.ini:

extension = php_pdo_mysql.dll
load more v
40%

How To Solve Laravel PDOException could not find driver Error ?,Here you have a missing dependency If you can, run.,How Laravel PDOException could not find driver Error Occurs ?,Hello Guys, How are you all? Hope You all Are Fine. Today I am facing the following error Laravel PDOException could not find driver in laravel. So Here I am Explain to you all the possible solutions here.

I have Connected my MySQL database with Laravel and now I am facing the following error.

php artisan migrate: refresh--seed[Illuminate\ Database\ QueryException]
could not find driver(SQL: select * from usa_client where type = 'table '
   and name = migrations)[Doctrine\ DBAL\ Driver\ PDOException]
could not find driver
   [PDOException]
could not find driver
load more v
22%

I have been trying to connect to MySQL from PHP using PDO. However, I get this error message:,Then run that script from the command line. If you don't get the 'could not find driver' error message, then that points to an incompatibility between your PHP and Apache versions.,PHP Fatal error: Uncaught PDOException: could not find driver in /home/abdullah/Documents/projects/cs50_radio/public/test.php:5 Stack trace: #0 /home/abdullah/Documents/projects/cs50_radio/public/test.php(5): PDO->__construct('mysql:host=127....'),Should my project folder contain any additional drivers or files? Or am I missing something in my code?

Here is my code used to connect:

< ? php
$user = "root";
$pass = "root";

$dbh = new PDO("mysql:host=127.0.0.1;dbname=radio;port=3306", $user, $pass);
//$dbh->query('INSERT INTO users (name) VALUES ("abdullah")');
$dbh = null; ?
>
load more v

Other "undefined-undefined" queries related to "PDOException “could not find driver”"