I try using xdebug with NetBeans to debug PHP. I start debug, and NetBeans waits for ever for a connection with xdebug. I have NetBeans 6.8 (latest version) with the latest MAMP package installed on my mac.
My php.ini looks like this:
[xdebug]
;zend_extension="/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
Finally, I had to add the idekey value like this:
xdebug.idekey="netbeans-xdebug"
now it works :-)
If your php.ini really looks like what you posted, you have to un-comment the zend_extension line (i.e. remove the ';' at its begninning), so Xdebug is actually loaded.
Then, make sure Xdebug is loaded, calling phpinfo() from a PHP file (just to be sure).
After that : I suppose there should be some options to configure the debugger in netbeans ? If so, is netbeans listening on port 9000 ? (The one you configured in php.ini)
The following settings worked for me with NetBeans 7.2 on Mountain Lion after restarting Apache:
zend_extension = /usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.idekey="netbeans-xdebug"
Mac/MAMP users: If you have tried all of the above and it still doesn't work, reboot your Mac. Restarting the servers through MAMP is not enough.
I used the following with XAMPP 1.8.2 and NetBeans 7.4 with success.
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.idekey="netbeans-xdebug"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = on
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_mode=req
xdebug.remote_host = "localhost"
xdebug.trace_output_dir = "C:\xampp\tmp"
for me worked this way (thank you guys +1) /o/
<pre>
zend_extension = "c:\xampp\php\ext\php_xdebug2.dll"
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_enable=1
xdebug.remote_handler"dbgp"
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.idekey="netbeans-xdebug"
</pre>
Config:
netbeans 7.3 - php 5.4 - xdebug 2.2 - xampp - win7(32bits)
I've read that xdebug doesn't work with the version of PHP what ships with OS X. I got it to work by updating php from version 5.4 to 5.5, using a handy package from php-osx.liip.ch, including precompiled xdebug extension. Use this command:
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5
Note that this will leave your default php installation intact, but disable it in httpd.conf. Your new php.ini will be at "/usr/local/php5/lib/php.ini", with the xdebug config file at "/usr/local/php5/php.d/50-extension-xdebug.ini".
Setup:
OS X version 10.9.2
Sources:
http://coolestguidesontheplanet.com/upgrade-to-php-5-4-or-5-5-mac-osx-10-8-mountain-lion/
Related
I need to debug my PHP scripts in a local environment but I'm having a "small" problem with my current set-up.
I was able to successfully install Xdebug, XAMPP, and the DBGp plugin for Notepad++.
The problem is that Xdebug is not showing up PHP variables in Notepad++
I already tried to disable OPCache, but it doesn't seem to be enough. phpinfo() seems to be fine..
These are my php.ini settings:
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=0
;zend_extension=php_opcache.dll
zend_extension = C:\xampp\php\ext\php_xdebug-2.7.0-7.2-vc15.dll
[xdebug]
xdebug.profiler_output_dir = "c:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%p"
xdebug.profiler_enable = 0
xdebug.profiler_append=0
xdebug.extended_info=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
;xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=xdebug
xdebug.remote_log="c:\xampp\tmp\xdebug_remot.log"
xdebug.show_exception_trace=0
xdebug.show_local_vars=9
xdebug.show_mem_delta=0
xdebug.trace_format=0
xdebug.max_depth=1
Any ideas on how to make this work?
How to install Xdebug with PhpStorm on localhost on Ubuntu?
I'm using PHP 7.2 and PhpStorm 2018.2.
I tried install apt-get install xdebug, then I've edited php.ini
[Xdebug]
zend_extension=/usr/lib/php/20170718/xdebug.so
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_enable = 1
xdebug.remote_port = 9001
xdebug.profiler_enable = On
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_mode=req
xdebug.idekey=PHPSTORM
When then when I go to php.info, I see the "IDE Key" a number not PhpStorm, and when I try to put breaking points it ignore them.
I fought this a lot, too. Let's see if this helps you. I use windows, but the principle should be the same.
1) Be sure, PHP storm uses the php.ini you edited. It can be different.
My php.ini xdebug settings:
[xdebug]
zend_extension="E:\Apache24\php\7.2.9\php_xdebug-2.7.0beta1-7.2-vc15-x86_64.dll"
xdebug.remote_autostart=0
xdebug.remote_enable = 1
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="E:\Apache24\php\7.2.9\tmp"
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.show_local_vars=0
xdebug.profiler_append = 0
xdebug.idekey=xdebug
xdebug.remote_mode=req
2) If you see this, then the extension is not installed correctly:
3) Check, if xdebug extension's version corresponds to your php version.
4) Press "Debug" button, not "Run"
5) Works well with breakpoints:
I am trying to install Xdebug for NetBeans. I am using a MAC and coding in PHP. I can see that xdebug.so is present at
/Applications/MAMP/bin/php/php7.0.2/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
The php.ini settings are:
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php7.0.2/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so"
xdebug.default_enable=1
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.idekey="netbeans-xdebug"
The NetBeans is listening at port 9000 too. But every time I launch the debugger it says Waiting for Connection (netbeans-debug)
The phpinfo() has no mention of xdebug ... why is this in spite of xdebug.so being present?
How do I make this work?
I use WAMP locally and Atom as my editor. I want to use Xdebug, so I installed the php-debug package in Atom. In Chrome I have installed the addon "Xdebug Helper" to turn off and on Xdebug with a simple button and I also added the IDE key xdebug-atom in the settings.
I added these lines in php.ini for xdebug:
zend_extension ="c:/wamp/bin/php/php5.6.25/zend_ext/php_xdebug-2.4.1-5.6-vc11.dll"
xdebug.remote_enable=1
xdebug.idekey = "xdebug-atom"
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=false
And in Atom I added these lines in config.cson:
"php-debug":
ServerAddress: "127.0.0.1"
ServerPort: 9000
currentPanelHeight: "292px"
currentPanelMode: "bottom"
I can toggle the Xdebug window in Atom and also set a breakpoint in my php script. But nothing happens when I reload my web application, I have tried changing all settings and rebooted both Atom and WAMP several times.
Can anyone see what I am doing wrong?
Finally I got it right. With these settings in php.ini the connection works:
zend_extension ="c:/wamp/bin/php/php5.6.25/zend_ext/php_xdebug-2.4.1-5.6-vc11.dll"
xdebug.remote_enable = On
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="C:/wamp/tmp"
xdebug.show_local_vars=0
xdebug.remote_autostart = 0
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
I have Netbeans 7.0.1 IDE, running on Windows 7 64-bit. I have installed the PHP through XAMPP 1.7.2. Running phpinfo() shows PHP version as 5.3.1 and XDebug version as 2.0.6-dev.
A web-page on netbeans.org has mentioned some entries to be uncommented in php.ini file, and has mentioned that compatible XDebug.dll is already provided with the setup.
These are entries from the php.ini file...
[PECL]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
[XDebug]
xdebug.remote_port = 9000
xdebug.remote_host = 127.0.0.1
xdebug.remote_handler = "dbgp"
xdebug.remote_enable = 1
xdebug.profiler_enable = 0
xdebug.profiler_append = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_name = "xdebug_profile.%p"
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.trace_output_dir = "C:\xampp\tmp"
xdebug.idekey = "netbeans-xdebug"
Heres is the snapshot of the debugger configuration from Netbeans IDE.
The Sessions debugger window doesn't show netbeans-xdebug session running.
After all these settings, the debugger is still not running.
I checked the ports using TCPView and it shows that port 9000 is free. Also the firewall is disabled.
Any help please?
[zend]
zend_extension = "path_to_xdebug"
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.profiler_enable = On
xdebug.profiler_output_dir = C:\Windows\temp
xdebug.dump_globals=On
xdebug.show_exception_trace=On
xdebug.collect_params=4
Try this. Save php.ini. Restart PC.
I know this question is old, but I had a similar problem, and my setup looked identical to yours except I'm on Ubuntu. I was able to get it working by simply making it a PHP project within Netbeans; apparently you cannot debug a single file.
You can create a project from an existing codebase and even store the project metadata elsewhere, by doing File->New Project.
Here is a snippet from my PHP.ini file:
[xdebug]
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.profiler_enable = On
xdebug.profiler_output_dir = /tmp
xdebug.dump_globals=On
xdebug.show_exception_trace=On
xdebug.collect_params=4
Make sure you restart the server and Netbeans after editing PHP.ini.