Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Oil migrate spitting out driver error
  • Hi there, I'm fairly new to PHP programming (IT worker that's been requested to become a basic programmer.) and found Fuelphp through a couple contacts who say it's really good for the first time user.

    I've managed to install everything fine and get almost everything running. Apart from when I try to migrate using OIL. The error that I get is:

    Error - could not find driver in COREPATH/classes/database/pdo/connection.php on line 94


    I'm running LinuxMint 14 and running this through the default linux terminal. 

    I've read around about other errors of this nature but they usually talk about invalid data source, not Drivers. I've made sure that everything is setup correctly, my database connection is working fine (I think, credentials are all perfect.) 

    http://pastebin.com/dnqUzhmk This is my /pdo/connection.php

    I'm really stumped, but really want to give this framework a good go before I write it off at the first hurdle.
  • What happens a lot is that the php-cli binary uses a different php.ini than the sapi version running in your webserver. Which causes the PDO driver not to be available when on the commandline.

    You can easy check this by starting the oil console ('php oil console'), and type:

    class_exists('PDO');

    If it responds with 'false', you have this issue.

    It could also be an environment issue. If you're not working in 'development', which is the default, you will have to tell oil which environment to load, using

    env FUEL_ENV=yourenvironmentname php oil <your command>

    You can check which environment oil is using via

    php oil -v

  • Thanks for getting back to me so fast. I was unable to check over the weekend but I'm back in the office now and have just ran both Class_exists and oil -v. 

    Oil -v shows that I'm currently working in the development environment.

    The class_exists returns true but when I loaded into the console a message pops up saying "Fuel 1.5-dev - PHP 5.4.6-1ubuntu1.2 (cli) (Mar 11 2013 14:56:27) [Linux]" my phpinfo() states it's running 5.4.7, Could that minor version difference be what is throwing the driver off? if so how would I go about changing either fuel or xampp to use the same?


  • I have no experience with XAMPP, but I've heard a lot of people complain about the php.ini problem.

    Best this is probably to do a search on your system for php.ini, figure out which one is the correct one (the one your apache module is using), and replace the others by a symlink, so all PHP versions use the same php.ini.
  • I have been messing about with the settings for a bit now and just tried to run:
    $ php oil refine session create
    A message appeared saying: 

    Your current driver type is not set db. Would you like to continue and add the sessions table anyway? 

    Could that be anything to do with it? How do I go about setting the driver type to db?
  • Looks like you haven't configured your sessions to use a database.

    Copy fuel/core/config/session.php to fuel/app/config, and modify it. 'driver' is the second item in that config file. You might want to look at the other config items, and at 'db' section as well, further down in the file.

Howdy, Stranger!

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

In this Discussion