Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Erro PDO
  • hello how do I troubleshoot pdo when using the migrate command? I've tried all options (wamp, lamp, Vertrigo apache php 5.3 php 5.4) and various operating systems but the error continued. C:\Program Files (x86)\VertrigoServ\www\fuelphp>php oil refine migrate Uncaught exception Fuel\Core\Database_Exception: could not find driver Callstack: #0 C:\Program Files (x86)\VertrigoServ\www\fuelphp\fuel\core\classes\database\pdo\connection.php(191): Fuel\Core\Database_PDO_Con nection->connect() #1 C:\Program Files (x86)\VertrigoServ\www\fuelphp\fuel\core\classes\database\query.php(287): Fuel\Core\Database_PDO_Connection-> query(1, 'SELECT * FROM `...', false) #2 C:\Program Files (x86)\VertrigoServ\www\fuelphp\fuel\core\classes\dbutil.php(621): Fuel\Core\Database_Query->execute(NULL) #3 C:\Program Files (x86)\VertrigoServ\www\fuelphp\fuel\core\classes\migrate.php(595): Fuel\Core\DBUtil::table_exists('migration' ) #4 C:\Program Files (x86)\VertrigoServ\www\fuelphp\fuel\core\classes\ - clear
  • It is a very simple problem.

    PDO exception "could not find driver" means either the DSN in your PDO config doesn't define (the correct) driver, or the driver is not installed in your config.

    If it does work from a webpage, but it doesn't from the commandline, chances are that your installation uses a custom php.ini location for the web SAPI, causing php-cli to run with a php.ini that misses everything, including PDO drivers. Complete packages like WAMP and MAMP (for Mac) are notorious for this problem.

    To find which ini file is used, use the  php_ini_loaded_file() function. Echo it out in a View, and use the oil console to check it's value on the commandline. I'm pretty sure you'll find them to be different.
  • php_ini_loaded_file() 
    returne 
    C:\Users\Joey\Documents\UwAmp\bin\apache\php.ini
    but php oil php_ini_loaded_file() this don't work 

  • No, you need to use the oil console (php oil console) and then type the function name.

    The console gives you an interactive PHP commandline in which you can type any PHP command, access any class in your app, run a DB::select on a table, etc. It's a very handy tool to use as a backdoor in your application, for debug purposes.
  • It's all set up right 
    so that the error continues; already tested it on my other computer 
    he is also windowns and gave the same error
  • If you say so.

    The error message is very clear: PDO Exception "could not find driver"

    If you Google for it you get tons of replies telling you all the same: either your DSN is wrong, or a PDO driver is not installed.

    And the fact that this happens with your code on all platforms suggests it is not a problem with the platform, but with your code. So either a DSN error, or incorrect setup of your db.php config files.
  • I already tried, I'll try again
  • If you don't give us any information, there isn't a lot we can do.

    What does your setup look like? What is in your db.php config? And where is this db.php file?
  • I tested the fuel on a linux distribution and everything worked, 
    I tried again later in windowns installing apache php and mysql all apart and gave error I think the core ta incompatible with windows.
  • I run Fuel on Windows 2012 server with WAMP, especially for compatibility testing. And that works without problems.

    You keep on complaining, but you don't give any information about your setup, your configuration, exact errors, what you have tried, and whether or not it is fixed. And I've asked for that repeatingly.

    Not all PHP distributions have all PDO drivers installed by default, and not all installations use the same php.ini for the php SAPI and php-cli.exe.

    I said it before, and I can only repeat myself: PDO Exception "could not find driver" means the driver is not installed, or your php interpreter uses a php.ini that doesn't load the driver.

    There are no more options.
  • Hey Harro Verton 
    I managed to solve my problem, I check the settings again and everything worked. 
    thanks for helping me
  • HarroHarro
    Accepted Answer
    And still we don't know what it was or what you did... ;-)

    Can you tell us, for future readers that also have this problem, what exactly you have done to fix it?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion