1. Owncloud Occ Could Not Find Driver
  2. Pdoexception Could Not Find Driver
  3. Owncloud Sqlite Could Not Find Driver
  4. An Exception Occured In Driver Could Not Find Driver Owncloud
  5. Php Artisan Migrate Could Not Find Driver
  6. Connection Failed Could Not Find Driver
  7. Php Could Not Find Driver

Failed to connect to the database: An exception occured in driver: could not find driver This shows that there is a misconfiguration in your PHP environment where the database driver is not correctly loaded. And check the output in /tmp/cronlog. The 'could not find driver' is normally caused by a missing pdo database driver. See the output of the cronlog for something like: PDO drivers => mysql pdo_mysql. Or similar mysql/mysqli/mysqlnd output. Update 8.2.9.4 to 8.2.10 'could not find driver' Server. My problem now ist, that I want to update my owncloud but I have no idea how to fix this problem. Owncloud installation issue with postgresql. Could not find driver. I also tried to use user account that OwnCloud created but then it says that PostGreSQL. How To Install and Configure ownCloud on Ubuntu 16.04. The ownCloud server package does not exist within the default repositories for Ubuntu. However, ownCloud.

Active10 days ago

I have just installed Debian Lenny with Apache, MySQL, and PHP and I am receiving a PDOException could not find driver.

This is the specific line of code it is referring to:

$dbh = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS)

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).

Is this something to do with my PHP installation?

Searching the internet has not helped, all I get is experts-exchange and examples, but no solutions.

ghbarratt
9,6084 gold badges36 silver badges41 bronze badges
Mike MooreMike Moore
3,0338 gold badges34 silver badges60 bronze badges

38 Answers

Owncloud Occ Could Not Find Driver

12 next

You need to have a module called pdo_mysql. Looking for following in phpinfo(),

ZZ CoderZZ Coder
62.4k26 gold badges121 silver badges156 bronze badges

The dsn in your code reveals you are trying to connect with the mysql driver. Your error message indicates that this driver is unavailable.

Check that you have the mysql extension installed on your server.

In Ubuntu/Debian you check for the package with:

Install the php5-mysql package if you do not have it.

In Ubuntu/Debian you can use:

  • PHP5: sudo apt-get install php5-mysql
  • PHP7: sudo apt-get install php7.0-mysql

Lastly, to get it working, you will need to restart your web-server:

  • Apache: sudo /etc/init.d/apache2 restart
  • Nginx: sudo /etc/init.d/nginx restart
ghbarrattghbarratt
9,6084 gold badges36 silver badges41 bronze badges

Update: newer versions should use php-sqlite3 package instead of php5-sqlite. So use this, if you are using a recent ubuntu version:

Original answer to question is here:

If your phpinfo() is not showing the pdo_sqlite line (in my case, on my Ubuntu Server), you just need to run the lines above and then you'll be good to go.

Sudipta ChatterjeeSudipta Chatterjee
3,4551 gold badge22 silver badges30 bronze badges

For newer versions of Ubuntu that have PHP 7.0 you can get the php-mysql package:

Then restart your server:

ThomasAFinkThomasAFink

On my Windows machine, I had to give the absolute path to the extension dir in my php.ini:

extension_dir = 'c:php5ext'

fvrghl
2,1832 gold badges22 silver badges34 bronze badges
berdziberdzi

I had the same issue. The solution depends on OS. In my case, i have debian, so to solve it:

  • Updated my php version from (php5 to php7)
  • Install php-mysql and php7.0-mysql

  • I edited my php.ini locate at /etc/php/7.0/apache2/php.ini

  • Then restart apache:

This solves my problem

Community
onlymeonlyme
1,4441 gold badge11 silver badges10 bronze badges
Dmitry SobolevDmitry Sobolev
Moses NandwaMoses Nandwa

Did you check your php.ini (check for the correct location with phpinfo()) if MySQL and the driver is installed correctly?

cemcem
2,9411 gold badge14 silver badges23 bronze badges

When adding these into your php.ini ensure the php_pdo.dll reference is first before the db drivers dlls otherwise this will also cause this error message too. Add them like this:

Luís Cruz
11.8k12 gold badges54 silver badges78 bronze badges
Paul FosterPaul Foster
Driver

For PHP 5.5 on CentOS I fixed this by installing the php55-mysqlnd package.

For help installing, write a comment as it depends on the way PHP is installed on your system. Available repo's are webtatic and remi.

SimonWSimonW
4,3873 gold badges23 silver badges34 bronze badges

I spent the last day trying to figure out why I was getting the following error. I am running Ubuntu 14.04.

The Problem:
I noticed that my PHP-CLI version was running php7.0 but php_info() (the web version) was displaying php 5.5.9. Even though php_info() said pdo was enabled, using the command line (CLI) wasn't recognizing the pdo_mysql command. It turns out that mysql was enabled for my old version but not the CLI version. All I did was install mysql for php7.0 and it was able to work.

This is what worked:

To check the version:

To install mysql for php7.0

1) make sure your CLI version is the same as your web version
2) If they are different, make sure your CLI version has the mysql plug-in since it doesn't come with it as a default.

Growling FleaGrowling Flea

for Windows 8.1/10 in :php.ini file you should uncomment line 'extension=pdo_mysql'

Egor DoynikovEgor Doynikov

Check if extension_dir in php configuration file set correctly. Try to comment/uncomment some extensions and see if it's reflected on phpinfo().If it doesn't then either php config file cannot be loaded (wrong location) extension_dir is commented or set to the wrong location.

hsergehserge

In my case my DSN string was incorrect, specifically it did not contain mysql://. I would have expected a different error message, perhaps something like 'DSN string does not specify driver/protocol.'

Adding mysql:// to the beginning of the DSN string resolved the issue.

cale_b
20.7k6 gold badges52 silver badges89 bronze badges
gpostongposton

The problem is a missing php to mysql library. In CentOs i fixed it by running # yum install php-mysql and then restarting apache with # /bin/systemctl restart httpd.service Note that the naming is slightly different from debian/ubuntu based distros, php->php5 and httpd->apache2.

Japheth Ongeri - inkalimevaJapheth Ongeri - inkalimeva
2,8956 gold badges23 silver badges43 bronze badges

I extremely recommend mysqllnd instead of mysql because of you would have a lot of problems like number converting and bit type evaluates problem with mysql extension.

on ubuntu install mysqllnd with following command:

MSSMSS

I Fixed this issue on my Debian 6.Normally I just had installed php5-common package. After installation, you have to restart your web server (apache or nginx depending on which one you installed).Then I just do an lsof on the apache process id (lsof -p process_id) as followed :

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 just don't know why it is installed on such a weird path, for me it's just a bug in the library package installation script in debian 6.I solved the issue by creating a symbolic for all the files under /usr/lib/php5/20090626/ to /usr/lib/php5/ with this command :

ln -s /usr/lib/php5/20090626/* /usr/lib/php5/

fvrghl
2,1832 gold badges22 silver badges34 bronze badges
douggynixdouggynix

I faced the same issue after I removed the php5 package (that includes all the drivers as well) in order to install php7 package. I actually installed php7 package without a mysql module.

I managed to solve it by typing in the terminal:

1) $ apt-cache search php7which lists all the modules, looking through the modules I found,

php7.0-mysql - MySQL module for PHP

2) $ sudo apt-get install php7.0-mysql

That's it. It worked for me in my linux system.

(use the appropriate php version, yours could be php5)

RoshimonRoshimon

Just one other thing to confirm as some people are copy/pasting example code from the Internet to get started. Make sure you have MySQL entered here:

In some examples this shows

dim8
2,6974 gold badges22 silver badges41 bronze badges
JoeJoe

I had the same problem during running tests with separate php.ini. I had to add these lines to my own php.ini file:

Notice: Exactly in this order

FacedownFacedown

In my case, I was using PDO with php-cli, and it worked fine.

Only when I tried to connect from apache, I got the 'missing driver' issue, which I didn't quite understand.

A simple apt-get install php-mysql solved it. (Ubuntu 16.04 / PHP7. credits go to the selected answer & Ivan's comment)

Hope it can help.

BalmipourBalmipour

For those using Symfony2/3 and wondering why you're getting this error. If you're using 'mapping_types', you might encounter this error. The reason is that 'mapping_types' is placed at the wrong level. For instance :

This 'mapping_types' must be placed at this level :

Ponsel BlackBerry yang lebih baru seperti Aurora dan KeyOne tidak terpengaruh karena sudah beralih menggunakan Android. Pengguna kedua OS BlackBerry dimaksud cukup mengunjungi toko aplikasi BlackBerry World di ponsel masing-masing dan memperbarui WhatsApp ke versi terbaru (2.17.1.2 untuk BlackBerry 10). Whatsapp tanpa blackberry world.

I hope this helps

I found the solution here : https://github.com/doctrine/DoctrineBundle/issues/327

aneth101aneth101

Everywhere I go I read that the path of extension_dir should be changed from ext to an absolute path. It worked for me. However, when trying to build a server of my colleague's PC, I had to let the value to ext instead of putting an absolute path.

If you did put an absolute path and it does the extension is still not found, considerer trying both with the absolute path and ext.

papillonpapillon

Incorrect installation of PHP was being called

Pdoexception Could Not Find Driver

I was experiencing the same problem. And I hope this would help someone who is having a similar issue as me.

Scenario

I created phpinfo.php file in the public folder and run the phpinfo() to look for the location of my php.ini file.

PHP.ini Location = c:xamppphpphp.ini

Problem
Calling c:xampphtdocs> php -v returned PHP 7.2.3 but phpinfo.php showed PHP 7.2.2.

Solution
Instead of calling

which gave me this error, I used

Owncloud Sqlite Could Not Find Driver

and it worked.

SollyMSollyM
1,0271 gold badge14 silver badges29 bronze badges

Check correct path in extension_dir in you phpinfo().

Alexandr NizhnikAlexandr Nizhnik

Check if the module is available with php -m grep pdo_mysql.

An Exception Occured In Driver Could Not Find Driver Owncloud

If not, for PHP 7.2, you can install relevant package with sudo apt install php7.2-mysql.

Use similar command on other PHP versions and package managers.

Pratik

Php Artisan Migrate Could Not Find Driver

Pratik
3611 gold badge5 silver badges13 bronze badges
fvrghl
2,1832 gold badges22 silver badges34 bronze badges
PersianuserPersianuser

I had the same exception when trying to use pdo_sqlite. The problem was that the automatically created 20-pdo_sqlite.ini and 20-sqlite3.ini symlinks (in /etc/php5/mods-enabled) were broken.

Removeing the broken symlinks and adding them manually with:

  • sudo ln -s /etc/php5/mods-avaliable/pdo_sqlite.ini /etc/php5/mods-enabled/20-pdo_sqlite.ini
  • sudo ln -s /etc/php5/mods-avaliable/sqlite3.ini /etc/php5/mods-enabled/20-sqlite3.ini

fixed the problem.

Note: this won't work for older php versions as they did not look for configs in /etc/php5/mods-enabled

ioleoioleo
2,9124 gold badges38 silver badges57 bronze badges

If you are using sqlite for testing you will need php sqlite pdo drive.You can install them as below.

For Ubuntu 14.04

In ubuntu 16.04 there is no php5-sqlite

Web Developer in PuneWeb Developer in Pune
12 next

Connection Failed Could Not Find Driver

protected by Your Common SenseAug 14 at 9:01

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

Php Could Not Find Driver

Not the answer you're looking for? Browse other questions tagged phpmysqlpdolamp or ask your own question.