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

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

edited Dec '19

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

$loader = new Loader();

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

edited Dec '19

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.

edited Feb '20

I had the same problem using command phalcon project demo2 (for create-project).

Phalcon DevTools (4.0.1)

Environment: OS: Windows NT DESKTOP-99F02F2 10.0 build 18363 (Windows 10) AMD64 PHP Version: 7.4.1 PHP SAPI: cli PHP Bin: C:\xampp\php\php.exe PHP Extension Dir: C:\php\ext PHP Bin Dir: C:\php Loaded PHP config: C:\xampp\php\php.ini Versions: Phalcon DevTools Version: 4.0.1 Phalcon Version: 4.0.3 AdminLTE Version: 2.3.6

I solved with https://forum.phalcon.io/discussion/20291/phalcon-4-new-project-error