I have a simple Apache + PHP 7.1 web server running locally.
I've got Xdebug helper installed in Chrome, and I click "Debug" in that.
I've got Xdebug 2.9.2 extension running successfully in PHP, with correct output from phpinfo();
When I run "validate" in PhpStorm I get green ticks for all but the last item, "Debug protocol '' is not supported", which has a yellow triangle.
I set a debug point in my code, and hit the green bug in the toolbar to begin a debugging session, and the only thing that's output in the Debugger "Variables" pane in PhpStorm is "Waiting for incoming connection with ide key '13508'" (this number changes every time).
Within php.ini I have set xdebug.idekey="PHPSTORM", and I've mirrored this in my Chrome Xdebug Helper.
I am not running Zend Debug.
I would really like to be able to debug properly. Any help is greatly appreciated.
Accordingly to your Xdebug log, you already have some service running on TCP 9000 port and that does not seem to be PhpStorm. Most likely it's php-fpm (it also uses the same port by default).
You can check that with netstat or alike (e.g. sudo lsof -nP -iTCP -sTCP:LISTEN if you are on Mac) -- it can show associated process ID (or even process name straight away).
Solution: change Xdebug port in both php.ini and PhpStorm to be some another number -- e.g. 9001 or so; restart web server once done.
Related
I am a big proponent of Xdebug and love PhpStorm. I have worked with many different setups for local environments and configuration seems to be a bit different each time.
My current environment is a docker container running on my local machine. I understand that PhpStorm is listening to 0.0.0.0, aka - to all network interfaces, and on a specified port (I'm using 9004). I also see that I can ping my local machine from the docker container hosting Xdebug.
What I don't understand is: when I put a breakpoint in PhpStorm, how does Xdebug know that it exists, so that when it hits that line of execution it should tell PhpStorm to stop?
When Xdebug first connects to the IDE, the IDE sends over a list of breakpoints that it wants Xdebug to interrupt PHP at. If you have a look at a log file (made with xdebug.log=/tmp/xdebug.log), then you will see commands being send starting with breakpoint_set. There is then a type (-t), often line for a file/line breakpoint, as well as the file name and line number.
When PHP runs code, Xdebug intercepts the execution, and when it sees a match filename/line number combination, it pauses the execution and goes into command mode so that the IDE can send commands to inspect the current scope (by sending content_get) as well as further information about variables (with property_get). Then when you click "Continue" or "Step Over", the IDE sends a command to Xdebug to do the equivalent action.
To see a full description of the protocol, give the DBGp protocol specification a read.
I can't seem to use xdebug in PHPStorm when running a local server. The server document root is the direct parent of the PHPStorm project root and I can run the project on a web browser and through the "Tools | Test RESTful Web Server" option.
I:
am running my Apache server on a mac (OSX 10.10.5) and used brew to install php 5.5 and xdebug 2.3.3 (which was honestly a huge hassle, as nothing wanted to work). The xdebug shows up properly in my phpinfo() and when I use the terminal command $ php -i so I think it is installed correctly.
have followed several guides, tutorials, and SO questions that either do not pertain to my situation and/or their answers were non-working or absent
Configuring Xdebug (PHPStorm) and may more from the PHPStorm website...
Connection Between PHP and Xdebug (SO) this one was the closest I could find to my situation and it did not resolve my issue either. All the other ones I could find were not very helpful because they were working with the MAMP stack.
can't validate my xdebug with PHPStorm in "Run | Web Server Debug Validation". Everytime I try, no matter how I fiddle with the settings, it is either a connection refused error (which I believe is because I am trying unopened ports) or this:
Web Server Debug Validation returns unexpected format error.
Both the bookmarklets that XDebugger supplies on their website and the browser extensions fail as well.
The weird thing to me is, if I create a virtual host in the apache httpd.conf with the servername as my external IP address and with the same document root, I can access it (not the weird part) but I can also run the debugger perfectly fine through it. This is undesirable as it seems that anyone can now run my code and receive responses with sensitive information. They might also be able to start my debugger, but that would be more of an annoyance if they could.
I have been able to, up until this point, work without a debugger, but there have been instances where it would have been great to have one. Looking toward the future I can say for certain that having a debugger will help immensely with my projects, so any help would be greatly appreciated.
I would also prefer not to reinstall everything as it was a huge pain to set it all up in the first place, but if it's a last resort I may have to.
I can provide more information if needed.
Thanks,
Jacob
I managed to get the step debugging to work with a couple changes:
For the validation test, instead of just localhost I attempted to validate a sub-folder that contains my code for the project. The PHPStorm project itself was set to this folder. I think that because my document root was outside of the project that it refused to validate the xdebug extension.
I also configured my DBGp Proxy under Tools to accept the IDE key that xdebug had set as default and updated the IDE key in the xdebug bookmarks.
I can now step debug with Run > Start Listening for PHP Debug Connections and in-browser using the XDebug Debugger bookmarks.
Jacob
In addition to the accepted answer, you need to download and run the debug proxy on the server itself
Download an install the Python Remote Debugging package from Komodo (http://code.activestate.com/komodo/remotedebugging/)
Start the DBGp proxy on the web server.
In PHPStorm, start listening for the debugger: "Run | Start Listening for PHP Debug Connections" (You may need to register the debug server: "Tools | DBGp Proxy | Register IDE")
Jet Brains how-to: https://confluence.jetbrains.com/display/PhpStorm/Multi-user+debugging+in+PhpStorm+with+Xdebug+and+DBGp+proxy#Multi-userdebugginginPhpStormwithXdebugandDBGpproxy-2.DBGpproxy
None of the suggestions worked for me, so I kept digging.
Even though IPV6 was disabled on my network adapter, it is still a preference on the loopback adapter.
A ping localhost would result in Reply from ::1: time<1ms
I've fixed this by preferring IPV4 over IPV6 in the Windows registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\TCPIP6\Parameters
Set DisabledComponents to Hex 0x20 or decimal 32.
Now ping localhost comes back as Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 and the debugger validation works fine.
I have a virtual development environment in vagrant which I have provisioned using puphpet.com. Until today, everything was in perfect working order, but suddently - seemingly unrelated to my actions - Xdebug stopped working.
I use phpstorm for development and debugging and what happens is, I set a breakpoint in phpstorm, then I enable the remote debugging listener in phpstorm and the Chrome Xdebug Helper extension. When the code reaches the breakpoint, execution is paused and I am able to investigate the different variables, but as soon as I try to step through my code with either continue, step over or step into, phpstorm simply exits debug mode and my browser shows a 503 error.
I had a look at the syslog, which shows that it is a segmentation error, so not much in the way of clues there. Then I enabled the Xdebug log. I don't really know how to interpret it, but it seems to me that it logs that it was succesfully able to stop at a breakpoint and then when the error happens it just stops logging - which makes sense considering that it seems to be a segmentation error.
I tried updating xdebug with pecl upgrade xdebug and I tried running it on a port different from the port 9000 default. Did not change anything.
Any suggestions what I might try now?
My virtual machine is running Ubuntu 14.04 LTS x64. PHP is v5.6.14 and Xdebug is v2.3.2.
Here is a link to my puphpet configuration in case it might help: https://gist.github.com/webconsult/dfa23f65ce2394624b0d
I faced the same issue after researching the error I found the solution and it worked!
kindly add the lines at the end of php.ini same as given just change your path...
[xdebug]
zend_extension="/usr/lib/php/20180731/xdebug.so"
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port="9003"
I was able to successfully install both Zend as well as Xdebugger. Verified by Phpinfo as well as Eclipse verifies the Zend debug successfully installed. Although whenever I run debug from eclipse for
Xdebug it hangs at 57%`
and for Zend debugger
the browser keeps processing/busy but nothing happens
Unsure what is causing this
-> Firewall issues?
-> No Selinux in Mac so not sure if it is a permissions issue
Any clues would be helpful.
Thank you.
it seems like a miss configuration of debug. I will try to help you showing my working configurations.
This is my php.ini piece for xdebug.
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.remote_enable=On
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9060
xdebug.remote_handler="dbgp"
xdebug.remote_autostart=On
It is important to note about the parameter debug.remote_host. If your client side is not allowed here, you will stuck on 57%. The value here is the IP of the machine where you are running eclipse. If you are running apache/php and eclipse in the same machine the localhost IP should work.
Adapt zend_extension parameter to your world.
Other reason you can stop in 57% is the web site is not running. Apache/PHP only will send xdebug metadata if the site is running. If you got an internal error, for example, you will be stuck on 57% also. Eclipse stops on 57% waiting for a xdebug session. You must be sure apache/php started a debug session.
Make sure the Debug configuration on eclipse is using the correct PHP server. If you are trying to run eclipse in an invalid PHP server or a PHP server which is not well configured you will stop on 57% also. So review the PHP server parameters on Debug Configurations.
Other important review you have to made is about the Xdebug configuration for eclipse. The port Debug port field must be filled with the same value of parameter xdebug.remote_port. If they are different you will be stuck in 57% also.
Please, let me know if it was helpful.
For Xdebug, this is likely a misconfigured path mapping in Eclipse. There are 10s of questions related to that here on stackoverflow and 100s of hits on google. Please check there first.
I have been trying to set up debugging using XDebug in Eclipse for the last few hours without success.
I have the following in my etc/php5/apache2/php.ini file
[XDebug]
xdebug.remote_enable=on
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_autostart=off
zend_extension = /usr/lib/php5/20090626+lfs/xdebug.so
The zend_extensions = /usr/lib...... was given to me by the custom installation instructions on the XDebug site. I followed the setup instructions exactly as they are on that page - http://xdebug.org/wizard.php
But from what I have read typing the command php -m should show XDebug twice, once under PHP modules and once under Zend modules. Well it is showing up under neither for me. So it seems that XDebug is not getting loaded at all?
Anyone any ideas on how to fix this problem and get XDebug working?
You've editted /etc/php5/apache2/php.ini file which is for apache. You'd want to edit /etc/php5/cli/php.ini for the command line interface's options.
If you pass in the phpinfo() from a web site, that PHP has run through Apache of course. And then the wizard will give you settings for the Apache set-up. If you would have passed the phpinfo() output (php -i) from the command line, it would have given you the settings for the CLI.
Something similar happened to me, the first time I setup xdebug in Eclipse it worked just fine, but the next time I tried it, it wasn't stopping at breakpoints. After a lot of research it turned out that I had 2 Eclipse instances running (one for Java and another for Php) and that caused some kind of issues with the debugger.
After closing both instances and starting Eclipse with php workspace first and then Eclipse with java workspace, xdebug worked fine again. My only idea is that debug port was already used when I tried to use it; or something like that.
An other common problem is that you use a router to get through INTERNET and that you had to forward XDEBUG PORT (generaly 9000) on your PC to make XDEBUG working with ECLIPSE.
But your router gives a dynamic IP to your PC and one day your mobile phone connects to the router before your PC and gets the IP address you configuredon you router IP FORWARDING !
The solution getting a static IP from your router. Here is an explanation: http://webologix.com/fr/blog/xdebug-eclipse-fonctionnement-aleatoire.html