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

how to debug phalcon

hello,

i am building a rather complex project and i don't know how to debug,

I tried


    ini_set('error_reporting', E_ALL);
        error_reporting(E_ALL);

but all i get is a blank screen

is there a way to debug phalcon?

Based on your other post I pulled your code and ran it, and the white screens are for several reasons

In the dispatch code:

     /**
        * Handle exceptions and not-found exceptions using NotFoundPlugin
        */
        $eventsManager->attach('dispatch:beforeException', new NotFoundPlugin);

You are attaching to the dispatcher and intercepting exceptions. In NotFoundPlugin:

$dispatcher->forward(array(
                        'controller' => 'errors',
                        'action' => 'show404'
                    ));

You are trying to forward to the errors controller, but there isnt an errors controller.

If you uncomment line 33:


                    //die($exception->getMessage());

You will see the specific error: ErrorsController handler class cannot be loaded

I will continue this answer over in your other thread to keep it on topic.



11.2k

For debugging at development, a good idea is to use the \Phalcon\Debug component.

Use the following code:

    $debug = new \Phalcon\Debug();
    $debug->listen();

It will show you a screen that helps you to track any exception AS LONG AS IT WAS NOT INTERCEPTED BY A TRY-CATCH BLOCK



16.6k

Yeah I agree with "heptagono" using built in debug feature is the best option.