Problem Start new Project in Phalcon

I just finished installing the phalcon framework, then I made a new project with name demo2 and there was a problem when it was run like this:

Demo2Controller handler class cannot be loaded

0 [internal function]: Phalcon\Mvc\Dispatcher->_throwDispatchException('Demo2Controller...', 2)

1 [internal function]: Phalcon\Dispatcher->dispatch()

2 C:\xampp\htdocs\demo2\public\index.php(42): Phalcon\Mvc\Application->handle()

3 {main}

I dont know where is the problem because i'm following tutorial from https://www.tutorialspoint.com/phalcon/phalcon_configuration.htm



67
edited 7d ago

could you post your \demo2\public\index.php file? you can also try

$loader = new Loader();
$loader->registerDirs([
    APP_PATH.'/controllers/',
    APP_PATH.'/models/',
]);
//$loader->register();

in your idex file (the controller "Demo2Controller" exists, right?)



89
edited 6d ago

Hello. I had the same problem using phalcon-devtolls, the project is already started with this problem. I solved it by starting the project on the PHP server, because I tried to use WAMP and XAMPP and it didn't work out. Start a server directly from PHP on your cmd: php -S localhost: 9001 -t public. (inside your project directory, of course). Sorry english for google translator rs. Hug.


Hello Friend. Digging a little deeper into the project I found that if I comment on this snippet of code located in the Services file, inside the config folder, the following snippet: $di->setShared('router', function () { $router = new Router(); $router->setUriSource( Router::URI_SOURCE_SERVER_REQUEST_URI ); return $router; });

The code worked perfectly. Hug.