Xdebug in v9 on OSX 10.10 not working
I am relatively new to phpStorm and have debugging working on a Macbook at home for a project. That's on OSX 10.8. I am now setting this up at work, on a new OSX 10.10 installation. Everything is clean as of yesterday. I have a MAMP installation to manage Apache/php/MySQL.
I have set up phpStorm as best I can according to the docs and my memory of what I did a few months ago at home. However when I attempt debug a script, it just runs without stopping. I have used the Validation tool to verify my installation. The results are:
(i) Server Name: 127.0.0.1
(i) Loaded php.ini: /Applications/MAMP/bin/php/php5.5.26/conf/php.ini
(i) Debugger extension: Xdebug 2.2.7
(i) Remote Host: localhost (...)
(i) Remote port: 9000
(i) Remote mode: 'req' (...)
Everything seems as it should be, but it's not working. I have installed the bookmarklets. I was attempting a zero configuration debugging session. The firewall on the Mac is off, for now. I have set it to break at the beginning of each script, and have also set a breakpoint on the 2nd line.
Suggestions?
Please sign in to leave a comment.
Hi there,
Is that a CLI script launched from IDE .. or a browser page?
If you are debugging a browser page -- please provide proofs that xdebug is installed and enabled -- phpinfo() output (header + xdebug-specific section)
Thing is: on Mac/Linux quite often (especially if it's a MAMP/MAMP RPO) you will have 2 differemt php.ini files: one for CLI (terminal) and one for actual Apache.
Hi. It's a browser page.
My testing page is itself just a call to phpinfo(). Here's the section for xdebug:
xdebug
and what php.ini is being used:
1) Please enable xdebug logging: http://xdebug.org/docs/all_settings#remote_log
2) Try debugging
3) Anything in the log?
4) If nothing ... place xdebug_break(); in your code (programmatic breakpoint). Anything in the log?
Basically -- I need to see the log -- only then I may tell what could be missing.
5) Where is your file is located (the path)? Does that path has symbolic link anywhere there? Thing is: xdebug works with final/resolved paths only .. so it may debug that script .. but IDE is unable to match that file to the file in a project.
6) BTW -- have you setup paths mappings for debugging. Please show screenshot of "PHP | Servers" from PhpStorm Preferences.
7) How do you debug? Do you use that "phone handle" icon (useful for zero-config approach .. or if debug is controlled/initiated from outside)?
P.S.
If possible -- see if you can upgrade xdebug to the latest 2.3.x branch
I don't know why, but it just started working while I was trying to provide answers to the above.
The first thing I tried was to enable the log. I did that, supplying first a full path to the MAMP logs folder and then with just a file name, and neither would generate a log file (yes, I restarted Apache and yes I searched my entire mac for the log to be sure it wasn't putting it somewhere unexpected). Phpinfo() showed that I had made the change.
So then I started doubting that xdebug itself wasn't actually functioning, despite the results shown in phpinfo(). So I googled for some xdebug settings that would show in html output that it was working. While doing that, I discovered a simple Xdebug debugging frontend called Codebug. This seemed to me to be a promising fork in the road to take, since if it worked it would suggest I had a phpStorm config issue, and if it didn't it would suggest an xdebug issue, or perhaps an issue with ports being blocked or something. In setting up Codebug, it supplied specific parameters for php.ini, namely:
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
I did all those things (restarting apache), but Codebug didn't work either.
So I continued with the idea of testing xdebug itself by forcing it to show debugging results in the web page itself. I settled on analyzing var_dump output, as xdebug's default setting reformats var_dump's output. Indeed it did! So it seemed to me that xdebug was functioning. However in the docs I noted that doing xdebug.overload_var_dump=2 is supposed to add more formatting, and I was curious to see that. So I added that setting to php.ini , restarted apache and reloaded the page.....
Codebug sprung to life! I had forgotten to turn off "listening" after I had seen it not working. So I turned off listening in Codebug and started listening in phpStorm, and it worked too!
It makes no sense, but it's working. I even disabled xdebug.overload_var_dump=2 and it still works. I hate not knowing why this happened because I fear it will stop for equally unknown reasons, but at least I know it's working now.
Glad it works now.
You seems to perfectly know what you are doing .. so I will leave this as a note only: "xdebug.remote_autostart=1" -- with such setting xdebug will attempt to debug every single request regardless of xdebug cookie/etc and will have a delay (apprx 1 sec) when executing scripts but no debug client (e.g. IDE) is listening for debug connections.
Thanks for that. I've been using IDEs for ages, starting with Zend Studio, then Aptana and then Eclipse, but all with zend_debugger. So I am relatively new to xdebug.