Search code examples
phpphinx

The file "phinx.yml" does not exist


I setup phinx using the --format php during the init. It is in the /config/database folder as database.php Whenever I try to run the migration I get the following error.

The file "phinx.yml" does not exist.

I'm now using a .yml file.

My phinx.php is in my root and looks like this

<?php

return
[
    'paths' => [
        'migrations' => './database/migrations',
        'seeds' => './database/seeds'
    ],
    'environments' => [
        'default_migration_table' => 'phinxlog',
        'default_database' => env('DB_ENV'),
        'production' => [
            'adapter' => env('DB_CONNECTION'),
            'host' => env('DB_HOST'),
            'name' => env('DB_DATABASE'),
            'user' => env('DB_USERNAME'),
            'pass' => env('DB_PASSWORD'),
            'port' => env('DB_PORT', 3306),
            'charset' => env('DB_CHARSET', 'utf8'),
            'table_prefix' => ''
        ],
        'development' => [
            'adapter' => env('DB_CONNECTION'),
            'host' => env('DB_HOST'),
            'name' => env('DB_DATABASE'),
            'user' => env('DB_USERNAME'),
            'pass' => env('DB_PASSWORD'),
            'port' => env('DB_PORT', 3306),
            'charset' => env('DB_CHARSET', 'utf8'),
            'table_prefix' => ''
        ]
    ],
    'version_order' => 'creation'
];

Solution

  • The config file should be in the same directory that you are running phinx from.

    Generally this would be the root of your project, rather than /config/database folder.

    You can either move it to the root, or you can point phinx to the file using the --configuration option:

    ./vendor/bin/phinx migrate --configuration config/database/phinx.php