Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Migration problem
  • Hi,
    I set up a really simple application. Yesterdat created models migrated database - everything worked fine. Today there is no problem in using application (it reads and writes to database with no problem), but I can't run any migration from command line. The error is: Error - invalid data source name in COREPATH/classes/database/pdo/connection.php on line 86 Any help would be appriciated. Best regards
  • Other possibility is that your CLI version of PHP runs with a different php.ini file then you MAMP install, I've seen that happen also.
  • hey im having the exact same problem. I've been banging my head on the wall.
    I've tried both root and my username under the terminal to get the migration done but nothing does it. Could you explain more your solution please?
  • Environment issue?
  • You are right. I was running migrations from wrong user account.
    Thanks for replay. Cheers!
  • I run my envirement on Synology DiskStation, there are two admin accounts there root and admin with the same password. I figured out that migrations work only if I run them on root account.
  • I have the same problem and I can't solve it. I am giving up and asking community for help. Explain me please how to fix it.
    OS: Archlinux i686
    php: 5.3.10 (without Suhosin-Patch)
    MySQL:  5.5.21
    FuelPHP: 1.1/master
    
    (18:04)[sariel@laptop: ~/Projects/fueltest]# oil r migrate
    Error - invalid data source name in COREPATH/classes/database/pdo/connection.php on line 86
    
  • in which environment are your database settings configured? And to they work when accessing them trough the browser?
  • in which environment are your database settings configured?
    Environment set in ./fuel/app/bootstrap.php
    Fuel::$env = (isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : Fuel::DEVELOPMENT);
    
    (01:09)[sariel@laptop: ~/Projects/fueltest]# cat ./fuel/app/config/development/db.php 
    <?php
    /**
     * The development database settings.
     */
    
    return array(
            'default' => array(
                    'connection'  => array(
                            'dsn'        => 'mysql:host=localhost;dbname=fueltest_devel',
                            'username'   => 'devel',
                            'password'   => 'devel',
                    ),
            ),
    );
    
    And to they work when accessing them trough the browser?
    When I am creating tables manually everything works fine. Also I have tried to switch to 1.1/develop branch but nothing changed.
  • So you haven't tested accessing from your app yet? Your config looks ok. Are you on a Mac by any chance? I've read that they have issues with using 'localhost', most people change it to something called 'local.dev' or '127.0.0.1' to work around it.
  • I have tried to use Fuel\Core\Migrate class from my app - it is working. Also I have tried to change localhost's name to fueltest.local , after that I have tried to run migration from CLI but nothing changed, I am still retrieving error published above. Interesting moment - I have tried to run migrations on another host (OS: CentOS; php: 5.3.3;) and migrations from CLI works normally.

Howdy, Stranger!

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

In this Discussion