Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
MAMP - php oil refine migrate causes error
  • Hello guys,

    I had this tutorial http://ucf.github.io/fuelphp-crash-course/ . Everything is working fine, until i input "php oil refine migrate" the console wrote these lines:

    Uncaught exception Fuel\Core\Database_Exception: SQLSTATE[HY000] [2002] No such file or directory


    Callstack: 


    #0 /Applications/MAMP/htdocs/fuel_intro/fuel/core/classes/database/pdo/connection.php(191): Fuel\Core\Database_PDO_Connection->connect()


    #1 /Applications/MAMP/htdocs/fuel_intro/fuel/core/classes/database/query.php(287): Fuel\Core\Database_PDO_Connection->query(1, 'SELECT * FROM `...', false)


    #2 /Applications/MAMP/htdocs/fuel_intro/fuel/core/classes/dbutil.php(621): Fuel\Core\Database_Query->execute(NULL)


    #3 /Applications/MAMP/htdocs/fuel_intro/fuel/core/classes/migrate.php(595): Fuel\Core\DBUtil::table_exists('migration')


    #4 /Applications/MAMP/htdocs/fuel_intro/fuel/core/classes/migrate.php(74): Fuel\Core\Migrate::table_version_check()


    #5 [internal function]: Fuel\Core\Migrate::_init()


    #6 /Applications/MAMP/htdocs/fuel_intro/fuel/core/classes/autoloader.php(375): call_user_func('Migrate::_init')


    #7 /Applications/MAMP/htdocs/fuel_intro/fuel/core/classes/autoloader.php(249): Fuel\Core\Autoloader::init_class('Migrate')


    #8 [internal function]: Fuel\Core\Autoloader::load('Migrate')


    #9 /Applications/MAMP/htdocs/fuel_intro/fuel/core/tasks/migrate.php(223): spl_autoload_call('Migrate')


    #10 /Applications/MAMP/htdocs/fuel_intro/fuel/core/tasks/migrate.php(151): Fuel\Tasks\Migrate::_run('default', 'app')


    #11 /Applications/MAMP/htdocs/fuel_intro/fuel/core/base.php(457): Fuel\Tasks\Migrate->__call('run', Array)


    #12 /Applications/MAMP/htdocs/fuel_intro/fuel/core/base.php(457): Fuel\Tasks\Migrate->run()


    #13 /Applications/MAMP/htdocs/fuel_intro/fuel/packages/oil/classes/refine.php(108): call_fuel_func_array(Array, Array)


    #14 [internal function]: Oil\Refine::run('migrate', Array)


    #15 /Applications/MAMP/htdocs/fuel_intro/fuel/packages/oil/classes/command.php(126): call_user_func('Oil\\Refine::run', 'migrate', Array)


    i've tried to change the host setting (in db.php) from localhost to 127.0.0.1 but unfortunately it showed the same

    any idea how to solve it?

    Best Regards
  • When it comes to using PHP and Fuel on the commandline, there are two things you have to take into account:

    There is a known issue on the Mac, which has to do with the fact that MAMP uses a non-standard location for the php.ini file. This causes php-cli which is used by oil to load the wrong php.ini, which in turn means it can't find the PHP modules for MySQL and/or PDO.

    Point two is that Fuel runs with different environments, each having their own db configuration. By default Fuel runs in the development environment, both in oil and via http. But if you have changed that in the app (or through the .htaccess) you need to tell oil which environment too use:

    env FUEL_ENV=production oil -v

Howdy, Stranger!

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

In this Discussion