XDebug / Apache / PHP / Eclipse skips breakpoints - php

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).

Related

Apache NetBeans 12.3 and XAMPP 3.2.4 PHP Breakpoints Windows 10

I spent a few days configuring the Apache NetBeans 12.3 and XAMPP 3.2.4 and PHP and I am not able to make it functional in way, that I will be able to debug the code with a breakpoints working.
I installed first new xampp make sure that is completely new installation.
Restart of pc needed so I did so.
Installed ApacheNetbeans 12.3 IDE
Checked the PHP.ini - first strange point. No [Xdebug] Were stated here.
I created new project in netbeans put phpinfo() inside run the page , page showed , copied the content , put it to setup wizard downloaded the dll , put dll to the certain place where they stated opened the php.ini ...
5.1 In php.ini no Xdebug was stated so at the end of the file I added [XDebug] and stated part of code.
5.2 I set up the port to 9000 (also 9001 in another attempt) and saved the php.ini with new values in.
6. Stopped the Apache, Stopped the mysql , turned off the Xampp , run xampp under admin rights , started the apache ,and started the mysql
7. NetBeans - opened the project, removed the phpinfo();
7.1 Added the lines: echo("Test"); $x = 1; echo("after Test");
7.2 Added breakpoint on $x=1;
Run in debug mode.
No breakpoint were catched. In netbeans there was a still message that stated: "Waiting for connection ..."
I am not sure what is here wrong , but I checked many other topics ( they are older than this one) and no solution worked. Is it still Apache netbeans and Xampp on windows 10 compatible ?
I know I was able to run and use it few years ago when it was not Apache NetBeans but just netbeans and I did not face that issue. Just installed both Xampp and Netbeans and no other special configuration were needed.
I turned off the firewall ,
checked if there is no zend tags in php.ini ,
checked if it installed it shows it is , and it is OK (shows versions) ,
changed ports to 9001 or different as was suggested in another threads ,
tested few different commands like xdebug.enable_remote = on , instead 1 and vice versa ...
after I clicked netbeans help which appears after I stopped debugging the link goes to not found page ...
I googled the wiki page of netbeans and proceed these steps as well ...
Did anyone face the same issue on clean install ? What is the solution for that or what I am doing wrong ?
Thanks so much .
Edit 17.5.2021 .
There is no antivirus installed and also windows firewall and defender is off .
Localhost can be loaded with page but no break points available.
Edit: Adding my log:
Xdebug installed: 3.0.4
Server API: Apache 2.0 Handler
Windows: yes
Compiler: MS VC15
Architecture: x64
Zend Server: no
PHP Version: 7.4.10
Zend API nr: 320190902
PHP API nr: 20190902
Debug Build: no
Thread Safe Build: yes
OPcache Loaded: no
Configuration File Path: no value
Configuration File: C:\xampp\php\php.ini
Extensions directory: C:\xampp\php\ext
NetBeans 12.3 and XAMPP 3.2.4 are compatible with win10.but if you pre installed antivirus software like avast or kaspaskey they will detect xampp as a malicious software.so before you run xampp turn off the antivirus software and try again.
First right click on your my computer icon & choose manage
then go to services and applications
select services
set windows defender startup type to manual instead of Automatic & restart the computer.and try again from installation xampp. you should try from xampp installation
If it does not work install a xampp old version and try again.
Sometimes windows defender detect it as a malicious software. So turn it off and try again.
There is no matter with netbeans ide.
If you getting problems with xampp every time install zend server or another WAMP software and continue work

PHP Xdebug Laravel application in IntelliJ IDEA

Could you please advice me how properly configure Xdebug for Laravel application. I found a lot instructions for PhpStorm but they do not work for me as I'm using IntelliJ IDEA Ultimate.
What I have already achieved - I can debug single PHP script but not whole application. I cannot follow completely the instruction which is given for PhpStorm because on step when I need to configure Run/Debug Configuration I got stucked.
Much appreciation on any help in advance!
Okay, I gathered full instruction how to work with XDebug and IntelliJ Idea Ultimate to debug Laravel application and Windows specifically (if you use other OS the installation part will be different but other should be the same):
First of all you need to install XDebug itself and configure PHP to work with it. For that:
Find out which PHP version you use using phpinfo() you will need Version, Architecture and PHP Extension Build sections to complete next step.
Go to https://xdebug.org/download.php and download appropriate build. Basically it is dll provided for specific PHP you have installed
After that copy that DLL to Apache modules directory - for me that is D:\OSPanel\modules\http\Apache-PHP-7-x64\modules\ as I'm using OpenServer.
Put into php.ini file following configuration:
[Xdebug]
zend_extension="D:\OSPanel\modules\http\Apache-PHP-7-x64\modules\php_xdebug-2.6.0-7.1-vc14-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_host = "localhost"
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_port=9000
xdebug.idekey="PHPSTORM"
where php_xdebug-2.6.0-7.1-vc14-x86_64.dll is name of dll I personally downloaded.
Restart Apache
Open your Laravel project and check your Debuggin configuration (File > Settings... > Languages & Frameworks > PHP > Debug): check XDebug section if Debug port is the same as you specified above (it should be, if you did not changet it previously)
Delete all your Run/Debug configurations
Install Xdebug Helper for Chrome or any other extension if your not using Chrome (Browser Debugging Extensions)
Hit Run > Start listening for PHP Debug Connections
Put break point in your project and open appropriate site context
Enjoy!
Hope that will be useful for community.

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 PDT + xdebug: step through code broken

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

php debugging on a Mac?

I've seen these answers: debugging php on mac?
but I am hoping that there is a better/newer solution. I am a system-level developer (C/C++/x86) but totally new to the web/scripting space. I feel that I would do well do setup a solid debugging environment - it is usually a great way for me to learn.
Any suggestions/pointers as to a good php debugging setup on a Mac (10.6) would be much appreciated.
Thanks,
Matt
I'm a Mac user myself and since I do some heavy PHP development, I need an elaborate setup for this.
First of all, the standard PHP and Apache installed in Snow Leopard isn't bad, but upgrading or adding extensions to it is quite a task. To be able to fully control the environment, I decided to install the entire AMP stack using MacPorts. Don't worry about overwriting existing files, as everything will be installed in separate locations. Just make sure you disable the stock Apache before starting the newly installed one. There are loads of tutorials on how to get this done.
My IDE of choice is Komodo IDE. This IDE comes out of the box with integrated debugging using a preconfigured xdebug setup. I have ended up compiling and using the latest xdebug version instead of the stock version for compatibility reasons (PHP 5.3+). Many developers use the aforementioned Eclipse + PDT which offers a similar IDE, although slightly more has to be done to get it configured properly.
For remote debugging I have configured the PHP module in apache to load xdebug also and connect to my running IDE. More info about that can be found here. For complex web applications it is ideal if you can just open the browser, navigate to the correct webpage and activate debugging to step into the first line of code of that page.
For performance testing and tuning I use the profiling feature of xdebug. When enabled, xdebug will write callgrind files to a specific directory. I use MacCallGrind to visually analyse the profiler files. There is a free alternative called KCacheGrind which can be installed if you enabled MacPorts (as mentioned in the first suggestion).
I use this environment to develop pretty complex and large multi-homed projects, involving commandline (daemonized) PHP applications that utilize forking and IPC structures and extensions like memcache. I'm quite satisfied with how this setup works for me.
There is a way how to do it using:
PhpStorm
Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Php + Xdebug
1) Install php and debug
brew install php70
brew install php70-xdebug
In PhpStorm - check Preferences => Language and Frameworks => PHP
Php language level: 7
Interpreter: PHP 7.0.8 + XDebug (or choose from [...])
Check debug config:
Preferences => Language and Frameworks => PHP => Debug => Xdebug section
All checkboxes should be checked and set Debug port to: 9001
2) run server in your app's directory:
php -S localhost:8080
3) Add localhost:8080 to PhpStorm Preferences => Language and Frameworks => PHP => Servers:
Name: Localhost:8080
Host: localhost
Port: 8080
Debugger: Xdebug
4) Update php.ini:
Php => Interpreter => […] => Configuration file - Open in Editor
Add this section: (check zend_extention path through the cli)
[Xdebug]
zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9001 (same as in Debug preferences)
5) Add Debug Configuration:
Run => Edit Configuration => add - Php Web Application
Choose Localhost:8080 server
6) Click Start Listening for Php Debug Connections
7) Set up breakpoints
7) Click on Debug (Green bug)
I'd also be interested in a better solution but I doubt there is one.
xdebug with a frontend like NetBeans, Eclipse or MacGDBp is probably where the bets go.

Categories