Can't read config.ini file when using phalcon dev tools

This is my config.ini file:

adapter     = Mysql
host        = localhost
username    = root
password    = 1234
dbname        = my_db

controllersDir  = ${PAPI_HOME_DIR}/app/controllers/
modelsDir       = ${PAPI_HOME_DIR}/app/models/
viewsDir        = ${PAPI_HOME_DIR}/app/views/
pluginsDir      = ${PAPI_HOME_DIR}/app/plugins/
libraryDir      = ${PAPI_HOME_DIR}/app/library/
cacheDir        = ${PAPI_HOME_DIR}/app/cache/
baseUri         = /

When I try to create a new model I got this error: PHP Warning: file_put_contents(/app/models/Ticker.php): failed to open stream: No such file or directory in /home/dima/Documents/phalcon-devtools/scripts/Phalcon/Builder/Model.php on line 624

How should I configure the config.ini file for phalcon devtools?

edited Jul '14

As far as I know, variables like ${PAPI_HOME_DIR} are not processed in a ini file

edited Jul '14

But this is works when I use this file with my phalcon app. I mean it looks like that my Phalcon app is able to parse the file correctly while phalcon dev tools can't... the environment variable is settrd uP for all users...


It's strange, because Phalcon use parse_ini_file ( which does not support parsing of variables.

parse_ini_file supports env variables, it's an undocumented feature. I think the problem is that you are using different environments. See this question and the relative answer.


I just added those two php rows to phalcon.php file to verify if my $PAPI_HOME_PATH variable is available.

echo getenv("PAPI_HOME_PATH");

and output was as expected: command: phalcon model --name my_table output: /home/dima/PhpstormProjects/papi

I agree with this.

'database' => [
        'adapter'     => getenv('DB_ADAPTER'),
        'host'        => getenv('DB_HOST'),
        'port'        => getenv('DB_PORT'),
        'username'    => getenv('DB_USERNAME'),
        'password'    => getenv('DB_PASSWORD'),
        'dbname'      => getenv('DB_NAME'),
        'charset'     => getenv('DB_CHARSET'),

Above is my configuration file, i use getenv as .env parser. Works well when run normally from server, but when use with phalcon-dev tools it returns

Error: Invalid database Adapter!