We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Notice: Undefined property: Phalcon\Config::$formsDir in C:\xampp\htdocs\invocare\app\config\loader.php on line 12

Hi,

I am trying to implement INVO on my basic Phalcon app, here is my loader.php file:

<?php

$loader = new Phalcon\Loader();

// We're a registering a set of directories taken from the configuration file
$loader->registerDirs(
    [
        APP_PATH . $config->application->controllersDir,
        APP_PATH . $config->application->pluginsDir,
        APP_PATH . $config->application->libraryDir,
        APP_PATH . $config->application->modelsDir,
        APP_PATH . $config->application->formsDir,
    ]
);

$loader->register();

And my config.ini file:

[database]
adapter  = Mysql
host     = localhost
username = root
password =
dbname   = invo
charset  = utf8

[application]
controllersDir = app/controllers/
modelsDir      = app/models/
viewsDir       = app/views/
pluginsDir     = app/plugins/
formsDir       = app/forms/
libraryDir     = app/library/
baseUri        = /invo/

I don't get how to solve this error, any help please ?

Maybe remove spaces? Not sure if they are included.



5.1k
edited Jul '17

Hi

try remove the last comma

on https://github.com/phalcon/invo/blob/master/app/config/loader.php


/**
 * We're a registering a set of directories taken from the configuration file
 */
$loader->registerDirs([
    APP_PATH . $config->application->controllersDir,
    APP_PATH . $config->application->pluginsDir,
    APP_PATH . $config->application->libraryDir,
    APP_PATH . $config->application->modelsDir,
    APP_PATH . $config->application->formsDir
])->register();


4.2k

Hello, I tried both solutions, none works...



4.2k

Ok, the solution is to add this line to config.php =>

'formsDir'       => BASE_PATH . '/forms/',


5.1k

Not sure it's a solution, the problem is somewhere else

Bad caracter in config.ini ? you can try to copy / paste code from here https://github.com/phalcon/invo/blob/master/app/config/config.ini

Can be leave a blank line at the end of the file ?

also

Can you post your bootstap code ?

/public/index.php

edited Jul '17

I don't understand, first you post config.ini and then you talk config.php. Which config extension you use? Maybe you have some kind of cache and you forgot to clear it? It's stupid to cache config.ini, linux will cache many time accssed file anyway. Caching it yourself will don't make almost any difference.



4.2k

@Wojciech Ślawski, in INVO project they use config.ini and in other project they use config.php, I had to mix 2 project that's why I have both files. But what's the difference between both, and which one to use in which situation ?



4.2k

@phil67000 when I added this line, the error disapeared, but another error remains: IndexController handler class cannot be loaded I opened anoter post about it.

You use which you like more, just your preference :)



5.1k

@Wojciech Ślawski, in INVO project they use config.ini and in other project they use config.php, I had to mix 2 project that's why I have both files. But what's the difference between both, and which one to use in which situation ?

in this project you use .ini or .php ?

Post the code of your index.php file , the code is not the same with config.ini and config.php

Just make a decision and switch to only-one type config. Don't see any logical reason to use two.