Eclipse PDT + xdebug: step through code broken - php

I'm using PHP 5.6.2 with xdebug 2.2.5 and Eclipse 4.4.1 with PDT 3.3.1. I'm trying to setup the debugger (xdebug) on a local server (localhost) and something appears to be broken.
When I start a debugging session eclipse switches to the debug perspective and stops at first line (as checked in config). The problem is that although the debugger (in debug window) seems to follow the execution as I step through code (it shows code lines as it advances), the window below that opens the source file and shows the code remains on the first position like/breakpoint it hits. It seems to be disconnected from the debugger...
Does anyone knows how to fix the problem ? Is it me, or there is a bug in this ? It used to work with older php/eclipse combination. I've upgraded php to 5.6 in between, as well as all it's dependencies. Same for eclipse. It's hard to pin point the issue at this point.
I'm using nginx with php-fpm.
Xdebug config in php.ini
[xdebug]
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"

This is a duplicate of xdebug breakpoints work but step over does not
You need latest PDT-nightly or downgrade to luna 4.4.0

Related

Configuring Xdebug for using zero-configuration debugging in Intellij

I'm using Intellij IDEA 2016.3.3 with the PHP-plugin of PhpStorm in Linux Mint 18. I try to configure Xdebug for using zero-configuration debugging. I followed the official guide and this video tutorial. However, the debugger does not stop at any breakpoint.
/opt/lampp/etc/php.ini (extract)
[Xdebug]
zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
xdebug.default_enable=1
xdebug.idekey=Intellij
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_connect_back=1
I generated Xdebug & Zend Debugger bookmarklets with IDE key Intellij.
Workflow:
Intellij: Run > Start Listening for PHP Debug Connections
I open a PHP-file of my PHP-project in Intellij that I'd like to debug.
I add a breakpoint
I open the file in the browser by clicking on the Google Chrome icon in the top-right corner
I click on the Start debugger bookmarklet in Google Chrome
I reload the page
I expect the debugger to stop at the breakpoint, but it doesn't
I'm not sure what I did, but it suddenly works. I did a restart of Intellij and now it works. I guess that I only did a reload of php.ini in the PHP settings after a relevant change of php.ini, but that didn't affect the build in web server.
#LazyOne Thank you very much for your help and patience.

xdebug 2 with PhpStorm setup error

I have been dealing with an unexpected error when trying to setup xdebug 2 with PhpStorm (2016.2.2). It says:
Connection with 'xdebug 2.5.0rc1' was not established. Validate installation.
I decided to ask for help because I cannot solve this error for 3 days already and I have tried everything I could.
These are the setup steps that I did:
pasted my phpinfo here (https://xdebug.org/wizard.php) and downloaded the recommended php_xdebug.dll (php_xdebug-2.5.0rc1-5.5-vc11-nts-x86_64).
copied php.ini file into bin\php\php5.6.0 and added these lines of code:
[Xdebug]
zend_extension = C:\MAMP\bin\php\php5.6.0\ext\php_xdebug-2.5.0rc1-5.6-vc11.dll
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.idekey=PHPSTORM
xdebug.remote_port = 80
xdebug.profiler_enable=1
Installed "JetBrains IDE Support" and "Xdebug helper" extensions for Chrome browser.
Sometimes I manage to debug (I guess) without an error but I get an error on browser which says "No direct script access allowed".
I am on Windows 10 x64 running MAMP 3.2.2 with php 5.6.0. Don't know what more details I can provide right now but it looks enough.
The problem that I had was on the other laptop that I use. Both of them use the same settings (win10, MAMP 3.2.2). On my second laptop (the one I am currently typing from) this is php.ini settings:
PHP version: 5.6.0 PHP CLI: C:\MAMP\bin\php\php5.6.0\php.exe PHP CGI:
C:\MAMP\bin\php\php5.6.0\php-cgi.exe Loaded Configuration File:
C:\MAMP\bin\php\php5.6.0\php.ini Debugger extension: xdebug 2.4.1
It uses xdebug 2.4.1 and I dont get the error on this laptop. I will try to get the same xdebug version to my first laptop and see if it works.
And this is the only command I added to php.ini on the second laptop (xdebug functioning) "zend_extension = C:\MAMP\bin\php\php5.6.0\ext\php_xdebug-2.4.1-5.6-vc11.dll" . Does it even make sense that without extra Xdebug settings it could even run?

Eclipse PHP won't stop at break points

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.

Debug php Eclipse

I'm having a very hard time getting a breakpoint to hit in some php code. I don't do much php so might be newbie error.
I've read though the other questions, PDT Install Instructions, and XDebug Install Instructions
For both debuggers, the instructions expect a config section to show up in the phpinfo() and it doesn't for me.
Some info about my current setup
Windows
AMPPS
PHP 5.2.17
Website runs fine
I need some help with things to check or ideas what I might need to do differently.
I'm stuck pretty much for now.
You can follow this post to install Xdebug for PHP in AMPPS.
Two main things that fixed my issues.
Turned off Iron PHP Loader
copied the non-ts XDebug .dll, even though the php config shows thread safe = enabled. This dll seems to work
The config settings are below for reference:
;Stuff to allow debugging in eclipse
zend_extension="C:\Program Files (x86)\Ampps\php\ext\php_xdebug-2.2.3-5.3-vc9.dll"
xdebug.remote_enable=On
xdebug.remote_autostart=On
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_mode=req
You do have to make sure and add the extra xdebug configurations or eclipse won't cooperate.

XDebug / Apache / PHP / Eclipse skips breakpoints

I'm having problems with XDebug.
Configuration as follows:
Windows 7 64bit
PHP 5.4.6 Thread Safe 32 bit
Apache 2.4 Thread Safe
Eclipse PDT 3.0.2
The problem is that xdebug_break() calls are not working, and breakpoints entered through Eclipse also don't function. I can see that the extension is working, as it appears as a module in phpinfo(). When I call an uncallable method, XDebug outputs the relevant error messages.
I've modified Eclipse's web server path mapping, to no avail.
Here is my php.ini config:
zend_extension = c:/php/php_xdebug-2.2.1-5.4-vc9.dll
xdebug.remote_enable = 1
xdebug.remote_host = localhost
xdebug.remote_port = 8080
xdebug.remote_mode = req
Any help would be kindly appreciated...
First check that what version you are using of PHP in eclipse....
Check it through:
Window->preference->PHP->PHP Interpreter....
Version there should match with the PHP version.....
Reply if problem is not solved....
For all those, that are still fighting with this problem, some handy tips.
Check which version (package) of Eclipse you have? It turns out, that Helios package has some bugs and doesn't stops on breakpoints, when you debug your application as Web Application. Debugging works only, if you run it as PHP Script. Which makes it pretty useless for debugging process.
You should consider either reverting to older Galileo Package Eclipse for PHP Developers or installing newest Eclipse Juno (or even newest developer version of Eclipse Kepler), which doesn't have PDT support build in, but you can easily add it to then, using Help > Install New Software.. (point it to http://download.eclipse.org/tools/pdt/updates/release).
These versions are reported to be able to debug as Web Application, respecting breakpoints.
Also, remember, that Xdebug must be run as Zend Extension in order to support breakpoints! In other words remove extension=xdebug.so (on Linux or xdebug.dll on Windows) line from your php.ini and replace it with zend_extension=/full/path/to/xdebug.so (on Linux or zend_extension=X:\full\path\to\xdebug.dll on Windows). Zend extensions requires full path, even if they're put into /php/ext folder, as regular PHP extensions. You'll find more info on this in Xdebug FAQ (look for an answer to "Xdebug is only loaded as PHP extension and not as a Zend Extension" question).

Categories