Beginner question : stuck at step 7 of "Zero-config web app debugging"
I am trying to follow the protocol of "Zero-configuration Web Application Debugging with Xdebug and PhpStorm"
at https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm
on my Yosemite Mac.
I went through steps 1 to 6 successfully (or so it seems) but I am stuck at step 7.
According to the protocol, "The “Incoming Connection” dialog should appear automatically.". It does not on my Mac,
and I don't know where to look for this "Incoming Connection" dialog in phpStorm.
Any help appreciated.
Please sign in to leave a comment.
Hi there,
Possibly you do not need it at all .. or (quite likely) you may already set them up.
Preferences | Languages & Frameworks | PHP | Servers
It seems that I do need it, since my browser and the debugger in PhpStorm seem disconnected.
Even through I set a breakpoint in index.php, when that page is loaded in my browser no "stopping"
happens in phpstorm or the browser as it should.
Regarding Preferences | Languages & Frameworks | PHP | Servers, I put the following parameters :
Name of Server : MAMP
Host : localhost
Use path mappings : Checked
Perhaps I misnamed the server ? Should it be called "8888" (since in my browser I usually type
localhost:8888/ to view my project files)
At the bottom, there's also two lines "Project files" and "Include path". Not sure what to do with
these.
Possibly (Yes/No).
No -- host name should be the domain name you are using to access this site. In your case it's "localhost"
Yes -- you need to use "8888" for port instead of default "80"
If you do not provide path mappings the you should uncheck this option.
Path mappings are necessary if you are using symbolic links anywhere in your project path .. or your actual project files are located in different folder to those that are actually executed by PHP (e.g. remote server etc). Thing is -- xdebug always uses final/resolved paths while IDE works with paths/symbolic links as is.
BTW: better post a screenshot instead of describing what you have got there by words -- you may unintentionally miss some details.
NOTE: if you already have server entry configured , then such dialog box (step #7) will not poup -- it only shows up if such entry (sfor such host) does not exist.
P.S. If you delete this server entry and try zero-config debugging again, step #7 should popup again.
" If you do not provide path mappings the you should uncheck this option."
I do need it actually, because I use a symlink. To be specific, in /Applications/MAMP/htdocs I created a symlink
called "phpstorm" linking to /Users/ewandelanoy/Documents/Math_software/Phpstorm_example
"If you delete this server entry and try zero-config debugging again, step #7 should popup again."
I tried this "restarting from scratch" strategy and still no popup at all. So I cannot execute step #7
and tell phpstorm what the path mappings are, because I have no popup window to write the path mappings in.
"better post a screenshot instead of describing what you have got there by words -- you may unintentionally miss some details."
Another screenshot which may be of interest : the browser window & the phpStorm window side by side
When, on the window on the left, I click "Start debugger" and reload the page, I see no reaction at all in the window on the right.
I still believe that you do not need that box checked.
Yes, the symbolic link is there .. but it's not used by actual xdebug as it takes files directly from /Users/ewandelanoy/Documents/Math_software/Phpstorm_example (where the project is).
You would need that and proper path mappings if, for example you would have "/Math_software/" in your project path as a symbolic link, because in this case PhpStorm will work with "/Users/ewandelanoy/Documents/Math_software/Phpstorm_example" but xdebug would work with (for example) "/Projects/Math_software/Phpstorm_example".
So .. try without check box.
If it's actually needed (which I currently do not see why) then you should put real path in the right column (absolute path on a server) -- just type path there.
Other suggestions:
1) Provide xdebug log for your debugging attempt: http://xdebug.org/docs/all_settings#remote_log -- maybe debug session does not even gets started
2) Ideally -- record some screencast where you do the debugging and show all configs (in case something else is missing -- you said it was working .. so I assume that xdebug and it's settings in actual IDE is configured correctly )
3) Back up and delete your project settings (.idea subfolder) while IDE is closed and re-configure project from scratch (You can use "Open" or "Open Directory" and point to the project root folder) .
As far as I can tell it's actually debugging (breakpoint is hit).
What it's debugging (how you run it) it's a different question -- it looks like you have debugging session for "PHP Script" type of Run/Debug Configuration running (CLI mode). By default PhpStorm accepts only one debug connection at a time -- you may increase this number in settings/preferences. Or just stop current debug session so next one may get accepted.
« Back up and delete your project settings (.idea subfolder) while IDE is closed and re-configure project from scratch »
I quit the phpStorm application, but when I looked in my project directory afterwards, to my surprise I saw no .idea directory there, so it seems something went wrong during the config phase.
« Provide xdebug log for your debugging attempt: http://xdebug.org/docs/all_settings#remote_log »
Sorry but I’m too much of a beginner to understand that suggestion fully.
After reading the documentation snippet you linked to, I know that there is a variable called debug.remote_log to be set correctly in the php.ini file. But how do I get access to the Xdebug log during the debug phase ?
Some more screenshots :
Step 1: Phpstorm is initially closed
Step 2: I open phpStorm next to the web browser
Notice that phpStorm automatically opens the index.php file and remembers the breakpoint I had put there.
Next, when I make the mouse hove over the red circle corresponding to the breakpoint, a Firefox icon appears
next to a Safari icon. When I click on the Firefox icon, it opens the index.php page in the Firefox window :
Folder starts with dot .. so by default it should be hidden in your Finder app.
You just open that generated file (which xdebug will create at the location you provide there) and send the content/attach it here. Obviously, the file should have write access for anyone.
Notice the different URL -- it uses PhpStrorm's own simple built-in web server and not your MAMP .. so it accesses the file differently and may use different php.ini file as well.
… and I can see it with ls -a though.
Right, so I deleted it, but when I restart phpStorm I still have my « phpStorm_example » among the list of old projects, is there a way to remove it from the list ?
I try to create a new project from scratch, but it fails rather quickly as shown in the
attached video. What did I do wrong ?
Attachment(s):
beg.mp4
Select (highlight) it on Welcome screen and press Delete key (or maybe Backspace on Mac -- not a Mac user here)
Remember my first answer here? You are not doing #2 -- you are doing #1 and you are making mistakes when entering your info.
Instead of "Create New Project from Existing Files" wizard just use "Open..." and point to your project root folder. Deployment/URL you can configure later manually via Preferences.
If you want to use "Create New Project from Existing Files" wizard then you should choose 1st option ("Web server is installed locally, source file is located under it's document root") instead of 2nd one as that one (2nd) requires copying project files from one folder to another (deployment).
Attached is the video of my latest attempt.
As you suggested, I just use « Open » and at the very beginning I check that Xdebug has beeninstalled correctly.Attachment(s):
beg3.mp4
You have not activated "phone handle" icon as described in that zero-config article and as result of it the xdebug was unable to contact PhpStorm as it was not listening on xdebug port.
FYI:
Checking for this in terminal does not guarantee that xdebug will be working when run in browser .. as you Apache in MAMP may use different php.ini.
To make sure that it is installed and configured -- better create some file with "<?php phpinfo();" text in it (e.g. "info.php" in this project) and execute it in a browser.
Attached is the video of my latest attempt (which incorporates all that has been said on this thread so far, unless I missed something).
Attachment(s):
beg5.mp4
Thanks.
1) Please show whole xdebug section of the phpinfo() output here
2) Please provide xdebug log for such unsuccessful debug session http://xdebug.org/docs/all_settings#remote_log (enable logging in php.ini; restart Apache (or whole MAMP); try to debug; provide file here)
3) Does placing xdebug_break(); on the top of the file makes any difference?
Here goes :
How do I do that ? (I know where my php.ini file is)
You have xdebug.remote_enable = Off -- debugger is disabled.
That's one of the basic requirements to have debugger working: https://confluence.jetbrains.com/display/PhpStorm/Xdebug+Installation+Guide
Also -- the xdebug log -- have a look for details: https://confluence.jetbrains.com/display/PhpStorm/Troubleshooting+PhpStorm+debugging
BTW: here is manual for MAMP (in case if you have not seen it yet)
https://confluence.jetbrains.com/display/PhpStorm/Installing+and+Configuring+MAMP+with+PhpStorm+IDE
The "xdebug.remote_log" variable, I mean.
Check https://confluence.jetbrains.com/display/PhpStorm/Troubleshooting+PhpStorm+debugging
Now that I have set xdebug.remote_enable, it works, finally. Thanks for your patience