I’m trying to do my first steps with PHP. I decided to use NetBeans, which seams helpful.
NetBeans is running on my local Windows machine. My testpage is running on an Apache2 webserver in my Ubuntu HyperV M.
Up to now everything works fine. Now I enabled remote debugging over Xdebug. Therefore I added the following lines to the php.ini:
[debug]
; Remote settings
xdebug.remote_autostart=off
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=192.168.2.20
xdebug.remote_port=9000
The connection is ok and debugging works. Unfortunately the debugger stops at each line and not only at my breakpoints. That makes my tests inefficient. Therefore my question is how to tell NetBeans to stop at breakpoints only?
Found the solution by myself. There is an option "stop at first line" in the Netbeans PHP debugging settings. Removing that did the trick.
Related
I am not able to step through my code. It works fine in 16.04. I dual boot into 18.04 and configured Apache 2, Xdebug, PHP 7.2 the same way but I cannot seem to stop at any of my break points.
The debugger stops ONE TIME at the first line (as that is how I have it configured in NetBeans 8.2). After that the debugger never breaks again. I disabled opcache to see if that was interfering but it didn't seem to help.
Note that if I debug a PHP-CLI application then Xdebug works fine. It seems to be an Apache 2 related configuration issue and I cannot seem to determine why.
Here is my 20-xdebug.ini file:
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
#xdebug.remote_log="/tmp/xdebug.log"
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.max_nesting_level=300
Argh!!!!
Found the issue. For some reason my browser had cookies disabled therefore XDEBUG could not store its cookie thus all subsequent calls back to the web application from the browser were not processed via XDEBUG.
I'm on Windows and I'm trying to debug a Web application (hosted with Vagrant/Homestead) using PhpStorm through XDebug. I tried many configurations but I can't get things working. The PhpStorm XDebug setup is pretty common.
This is the current xdebug configuration:
vagrant#homestead: /etc/php/7.0/cli/conf.d/20-xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable = on
xdebug.remote_connect_back = on
xdebug.idekey='PHPSTORM'
In the IDE "Start listening for PHP debug connections" it's turned on. When I attempt to start debugging a new chrome tab opens and the URL ends, for example, with ?XDEBUG_SESSION_START=16588 but the debugger doesn't run and this is what the IDE says:
Also, netstat says the port 9000 is still listening.
Any idea?
You are changing the 20-xdebug.ini file for the Command Line Interface (CLI). Instead you need to change the /etc/php/7.0/apache2/conf.d/20-xdebug.ini for the Apache settings, since you are using Chrome.
UPDATE
I'm not sure of the differences between Apache and Nginx (which may be /etc/php/7.0/fpm/conf.d/20-xdebug.ini), but here is how I got it working with a VirtualBox VM running Apache, on a Windows computer.
Settings for 20-xdebug.ini:
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=192.168.1... (your windows IP address within your network)
xdebug.remote_port=9000
xdebug.autostart=1
I am trying to set up xdebug so that I can debug my php wordpress project. I am using MAMP to run the project and have configured xdebug in the php.ini file as follows.
zend_extension="/Applications/MAMP/bin/php/php5.5.26/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"
debug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.idekey=“netbeans-xdebug”
xdebug.remote_port=9001
xdebug.remote_autostart=1
This is working as I can see xdebug in my phpinfo().
phpinfo
I'm now trying to connect netbeans to xdebug so that I can actually debug my code. I have pointed netbeasns to xdebug-netbeans at port 9001. I then try to debug my project but it just gets stuck on
waiting for connection(netbeans-xdebug)
It has worked for me twice (it went to debugging mode) but after clicking continue (it stopped on the first line in index.php) it wouldn't work anymore and the page wouldn't load. I then tried to reload the debugging but it went back to waiting for connection.
Any idea what's wrong?
Thanks.
In the php.ini file
implicit_flush = On
(by default it will be Off).
Here PHP will tell the output layer to flush itself automatically after every output block.
I Hope this helps.
I'm running Eclipse on Ubuntu 13.1 (I know, the worst Linux ever).
The fact is that I'm not used to Eclipse moved from Komodo 2 weeks ago, and the main reason why I'd migrated to Eclipse is debugging. But I can't put that to work. I already follow some tutorials with no joy.
My Xdebug is installed and working (checked with phpinfo()). I'm configuring Eclipse to work with Xdebug, but when I start the debugging it ignores the break points, even if I check to "Break at First Line" it won't break.
Here's a summary of the scenario that I have:
System: Ubuntu 13.1 64bits
PHP: 5.5.3-1ubuntu2.1
Xdebug: 2.2.3
Eclipse Platform: 3.6.2
PDT: 2.2.1
Tnx!
Problem solved! Actually the xdebug was installed but I missed one configuration. The xdebug.ini file was with only the following line:
zend_extension=/usr/lib/php5/20121212/xdebug.so
I'd added the following lines:
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
and it's working! Just reconfigured the eclipse debug and is working.
My work setup is a Windows XP host, running an Ubuntu VM LAMP stack. I am using PhpStorm to edit my code on my host Windows machine. Upon saving files are automatically uploaded to the VM via SFTP. Everything works for this process, except debugging.
I have setup PhpStorm to have a server named "UbuntuVM" with the following settings:
Debugger:
- XDebug
Debug session settings:
- Break at the first line
- Wait for connection with ide key: XDEBUG_PHPSTORM
Before launch:
- Upload files to selected server
I am using Chrome with Xdebug Helper, and have set the extension to use "Other" as the IDE, with "XDEBUG_PHPSTORM" as the key.
The VM has the following in the php.ini:
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=10.1.6.22
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.collect_params=On
xdebug.show_local_vars=On
When I set a break point in my IDE, enable the debugger in Chrome, and reload the page, I never hit the break point; and the IDE says "Waiting for connection on port 9000 with ide key 'XDEBUG_PHPSTORM'".
Does anyone have any idea why I'm not hitting my break points?
Comes to find out that xdebug.remote_host isn't needed, rather, use xdebug.remote_connect_back=1.