PHPEclipse & XDebug script debugging - php

I am trying to get XDebug debugging working in PHPEclipse.
All the resources I have found on the net are centered around using a web server with remote debugging. I am trying to achieve script level debugging so no web server is involved.
I have a debug configuration setup using the "PHP XDebug Script" type, and when I run the debug option in Eclipse, PHP is executing the script and output is sent to the console generated by the script.
What is wrong however, is the debugger is not stopping on any breakpoints that I add to the file in Eclipse. They are being skipped. How do I make the breakpoints work?
PHP & XDebug versions installed:
PHP 5.3.10 (cli) (built: Feb 2 2012 22:12:16)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.1.4, Copyright (c) 2002-2012, by Derick Rethans
I have not added any additional configuration options for XDebug within PHP. Whilst I have tried adding remote debugging options to see if that solves the problem, I assume all remote debugging options at this point are not relevant for doing localised script debugging so removed them again (and it didn't fix the problem anyway).
I am using Eclipse version 3.7.1 R3_7_1. on Fedora 16, 64bit.

Related

Xdebug not working on Mac (using PhpStorm)

I've recently had to swap over to a MacOS for development. Previously I had Xdebug running fine and it's such a massive help that I want to use is again.
I followed the Mac/homebrew instructions here: https://xdebug.org/docs/install#pecl with some more information that I found here: https://xdebug.org/docs/install#configure-php
php -v:
Cannot load Xdebug - it was already loaded
PHP 7.4.27 (cli) (built: Dec 16 2021 18:02:37) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans
with Zend OPcache v7.4.27, Copyright (c), by Zend Technologies
In my php.ini (I double checked that it was the correct one) I appended
zend_extension=xdebug
I am running my site on a docker setup, and am using PhpStorm, here are the settings:
I have the Xdebug extension installed in Chrome and have made sure that PhpStorm is listening. However, when I put a breakpoint in my home controller and navigate to that page, the page loads without any breakpoints being hit.
phpinfo() also shows that xdebug is loaded:
I've noticed that the xdebug version shown in the phpinfo dump does not match the version of xdebug I downloaded and installed:

PhpStorm Zero-Configuration Debugging not working for PHP 5.4.19

I'm using XAMPP version v3.2.1 and here's the output of php -v:
PHP 5.4.19 (cli) (built: Aug 21 2013 01:12:03)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
I want to set up Zero-Configuration Debugging with PhpStorm, so I followed all the steps (I think) and tried to launch a PHP file with breakpoints placed on it. But for some reason, when I open / refresh the page, it doesn't detect the breakpoint at all, nor it shows the incoming connection screen in PhpStorm.
I validated my setup here:
and I'm using https://github.com/BrianGilbert/xdebug-helper-for-firefox Firefox plugin.
I just want to simply debug my local PHP website as I browse through it, what am I doing wrong?
You are using PHP 5.4. Please, for the love of god, upgrade. This, and Xdebug's 2.2, haven't been supported for half a decade. Neither PHP 5.4 or Xdebug 2.2 are supported any more, and not for a very long time.

error upgrading php in mac

I am running OSX El Capitan (version 10.11.6).
I had php 5.5 installed.
Phpunit requires php5.6 and more so I tried to upgrade my php to 5.6. I couldn't do it so I gave php7 a try.
I followed these guides:
https://coolestguidesontheplanet.com/upgrade-php-on-osx/
https://php-osx.liip.ch/
Mac upgraded PHP to 5.6, but CLI php -v get 5.3.28?
My current output with php -v is :
PHP 7.0.12 (cli) (built: Nov 1 2016 10:21:11) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.12, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
Funny thing, my output with a phpinfo(); when called from somewhere inside a Symfony project, is still PHP Version 5.5.36
Any ideas??
Terminal uses a different PHP than a HTTP server in browser. You can check what PHP you're using in CLI (command line interface) by this terminal command:
$ which php
I don't know if you use any AMP stack (like MAMP). They include their own PHP, so you need to update them in order to have a different PHP version in browser.
Maybe you can use this trick to determine what PHP versions you use in browser / CLI: Find the php.ini path in your phpinfo() output and compare it with this terminal command:
$ php -i | grep php.ini
It's always a good idea to use the debug URL to troubleshoot your Symfony projects; to use this, simply append:
app_dev.php
For example if your route was like http://myhome/, then you would use:
http://myhome/app_dev.php
Then on the bottom of your browser you will have the Symfony debug bar. In the bottom right corner, the version of Symofny is shown, an if you move your mouse over it, you will see the version of PHP; plus also a link to "View phpinfo()". You can click on it to view the full PHP information, including where the PHP file is located.
The PHP config file used (shown on the phpinfo() page) is shown by:
Loaded Configuration File
Hope that helps!

PHPStorm not disconnecting with XDEBUG on MacOS X

I am having connection difficulties with PHPStorm 8.x and remote XDEBUG running on a nginx server, wherein XDEBUG doesn't terminate upon cancelling the HTTP Request during a site reload or navigating to a different url.
The issue occurs sporadic, sometimes quickly turning the Debug-Listening button on and off helps terminating and breaking anew at a preset breakpoint.
PHPStorm has been continuously upgraded to the latest version since 8.0. PHP/XDebug are used in the following versions, on an nginx server:
PHP 5.4.36-1~dotdeb.0 (cli) (built: Dec 19 2014 22:51:27)
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with Xdebug v2.2.6, Copyright (c) 2002-2014, by Derick Rethans
The PHP> Debug Settings in PHPStorm are set as follows:
Any help or pointers are highly appreciated.

Eclipse-Juno breakpoints not hit with PHP 5.4.8-1

Just installed Eclipse-Juno and the associated PHP Development Tools (PDT) SDK from org.eclipse.php.sdk.feature.group.
php --version yields:
PHP 5.4.8-1~precise+1 (cli) (built: Oct 29 2012 14:58:46)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.2.0, Copyright (c) 2002-2012, by Derick Rethans
Php -m indicates that xdebug is loaded.
[Zend Modules]
Xdebug
In eclipse, Windows->Preferences->Php->Debug->PHP Debubber is Xdebug.
However, none of my breakpoints hit.
What should I check to make debug breakpoints work for PHP on Eclipse-Juno?
I suppose, you are calling your scripts from a web browser. You need to tell xdebug to actually stop on breakpoints. If you are using Firefox, you can use easyXdebug for that. Make sure to enable remote debug in your xdebug.ini (explained in the extension preferences) and also in eclipse (Windows->Preferences->Php->Debug->PHP Debugger->Config). Then you can enable debug by clicking the little icon in your browser status bar for the next request.
For other browsers there should be Plugins as well, but I haven't used any.

Categories