Xdebug on OS X partially works (for example, it traces the stack trace in the terminal, but not in the browser).

I am trying to get xdebug to work on my Mac. I am using OS 10.6 with built-in Apache (2.2.1) and PHP (5.3.8). I followed the " customized installation instructions " on the xdebug website, which basically consisted of the following steps:

  • Building xdebug (version 2.1.3) from source
  • Move xdebug.so

    to/usr/lib/php/extensions/no-debug-non-zts-20090626

  • Add to php.ini: zend_extension = / usr / lib / php / extensions / no-debug-non-zts-20090626 / xdebug.so
  • Reboot the web server.

From what I understand this should be the case. I know that most people use xdebug with an IDE like PHPEclipse, but it doesn't seem like what you need to just get the debug output on the page. And a lot of the old instructions include installing MAMP, but it looks like it's no longer needed.

Xdebug signs work: When I run php -m

and phpinfo()

, I get the expected information about xdebug. In scripts, I can call functions like xdebug_is_enabled()

(returns 1) and xdebug_get_function_stack()

(returns stack).

Xdebug paths not working: The main reason I installed xdebug was to get the stack trace when there is an error and it doesn't. According to this documentation page , I should get a stack trace if the option is display_errors

set to On. In php.ini (which). I've tried code that should throw a warning (for example echo(hello)

), as well as code that throws a fatal error (for example $x->awesomefunction()

, when $ x is not an object). None of them output any xdebug output, and the fatal error just makes the page die silently. The test code given in the documentation I'm linked to also gives nothing.

UPDATE: It turns out that if I run the script with a fatal error from the terminal, I get the stack trace from xdebug. However, it still doesn't show up when I run the script from the browser

Also, the regular error message has now been fixed: I used to get an error including the commands:

ini_set("display_errors","1");
ERROR_REPORTING(E_ALL);

      

Now by putting these lines in my script there are no error messages coming up either. (in the browser. This results in errors when running the script from the terminal.)

So what's wrong here? Am I missing something from the xcode installation? I have a setting hanging somewhere on my system suppressing errors? I've tried everything I can think of, but I'd be happy to test any ideas you might have.

+3


source to share


2 answers


After a few hours of hiatus, I found that one of my test files actually included another file that set display_errors to 0. Another test file was directly from the xdebug site, but I think at the time I was using it , I introduced another configuration error that prevented it from working as expected. I'm really confused! Let this be a subject lesson today in the importance of systematic, repeatable tests during debugging. On the bright side, xdebug now works like a peach.

To summarize, the following steps have been taken:



  • Building xdebug (version 2.1.3) from source
  • Move xdebug.so to / usr / lib / php / extensions / no -debug-non-zts-20090626
  • Add to php.ini: zend_extension = / usr / lib / php / extensions / no-debug-non-zts-20090626 / xdebug.so
  • Add to php.ini: display_errors = On
  • Reboot the web server.
0


source


If it works in the console and not in the browser, it is probably a xdebug configuration issue.

I'm not a Mac user, but there are 2 different php.ini files on Ubuntu, one for the console and one for apache. If this is the case for Mac as well, you can check if xdebug is enabled and configured correctly in both php.ini files.



Also you can check the xdebug settings mentioned in the manual .

0


source







All Articles