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 in the first part of the Phalcon Tutorial

I am going over the tutorial. As instructed I copied the tutorial/public/index.php, and the app/controllers/IndexController.php. I run Xampp, and According to the tutorial when entering localhost/tutorial I should see the text "Hello!" on the screen, but what I get is: "Exception: IndexController handler class cannot be loaded". Any suggestions?



43.9k

Hi,

phalcon just can't find your controller.

you will have to adjust the path of controller folder in $loader->registerDir() method (maybe DIR . "/../app/controllers/" )

Hi, if you use namespace do you need map the namespace to a real path (loader.php) and in the (services.php) do you need informate the default namespace on Di "dispatcher", inside of the anonymous functions do you check if exists a follow method:

$dispatcher = new Dispatcher(); $dispatcher->setDefaultNamespace("App\Controller"); return $dispatcher;

In the IndexController the namespace need to be equal that setDefaultNamespace



13.8k

It doesnt answer your question but i think it would help you if you setup the developer tools and create a empty project with it, so you have a nice starting point.