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

Phalcon Debug not working


I have added this code at the top of my bootstrap file (public/index.php) :

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

...and then purposefully made an error in one of my PHP files. I get to see a blank screen, but not the desired Phalcon Debug screen.

I have checked previous discussions and removed the try/catch block from the bootstrap, but to no avail. Right now I can only debug by tailing the Apache log.

I must be overlooking something, but can't figure out what. Anyone got an idea? Thanks, Alex



Are you sure install xdebug?

edited Oct '14

Yep, I have that installed. The strange thing is that it started working just earlier (perhaps it was a cache issue), but only for Phalcon-related functions/methods. If there is something wrong on the PHP level, there is no debug. I suppose this is the way it's intended?

In any case, it would be great if generated MySQL queries would also be included in this debug info.

Regards, Alex

Can you post the content of your index.php file? Here's what mine looks like:

$Debug = new \Phalcon\Debug();

require '../app/config/bootstrap.php';

# Handle the requested URL
$App = new \Phalcon\Mvc\Application($DI);

# Echo the output
echo $App->handle()->getContent();


Here it is:


  use Phalcon\Dispatcher,
    Phalcon\Mvc\Dispatcher as MvcDispatcher,
    Phalcon\Events\Manager as EventsManager;

    $debug = new \Phalcon\Debug();

   //Register an autoloader
   $loader = new \Phalcon\Loader();

   //Create a DI
   $di = new Phalcon\DI\FactoryDefault();

  //Setup the database service
      $di->set('db', function(){
          return new \Phalcon\Db\Adapter\Pdo\Mysql(array(
              "host" => "localhost",
              "username" => "user",
              "password" => "pass",
              "dbname" => "db"

   //Setup the view component
   $di->set('view', function(){
       $view = new \Phalcon\Mvc\View();
       return $view;

   //Setup a base URI so that all generated URIs include the project folder
   $di->set('url', function(){
       $url = new \Phalcon\Mvc\Url();
       return $url;

   * We register the events manager
  $di->set('dispatcher', function() use ($di) {

    $eventsManager = $di->getShared('eventsManager');

    //Attach a listener
    $eventsManager->attach("dispatch:beforeDispatchLoop", function($event, $dispatcher) {

        $keyParams = array();
        $params = $dispatcher->getParams();

        //Use odd parameters as keys and even as values
        foreach ($params as $number => $value) {
            if ($number & 1) {
                $keyParams[$params[$number - 1]] = $value;

        //Override parameters

    $dispatcher = new MvcDispatcher();

    return $dispatcher;

   //Handle the request
   $application = new \Phalcon\Mvc\Application($di);

   echo $application->handle()->getContent();

Are you generating an error, or an exception? A fatal error will stop output from being generated (due to output buffering), but it won't cause the debug screen to appear.

edited Oct '14

I was indeed generating an error. So my understanding now is that it will only work with Exceptions, not core PHP errors.