XDebug breakpoints aren't hitting - php

I am trying to get XDebug (version 2.5.4) working with PHP Storm, with PHP 7.
I am using Windows and running my application off of a CentOS virtual machine, with PHP 7 set up in the CLI settings of PHP Storm, in order to debug.
Here is what my configuration looks like:
[xdebug]
zend_extension="C:\wamp64\bin\php\php7.0.10\ext\php_xdebug.dll"
xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.idekey = "PHPSTORM"
xdebug.remote_autostart = 0
xdebug.remote_port=9000
xdebug.remote_host=etc...
xdebug.remote_handler=dbgp
I am using Postman, with ?XDEBUG_SESSION_START=PHPSTORM at the end of the API endpoint, and the cookie with contents XDEBUG_SESSION=PHPSTORM; in the body.
I am clearly setting breakpoints, but I keep getting the message Debug session was finished without being paused
I also have the path mapping set up correctly, between the File/Directory and Absolute path on the server:
I can also get it to stop at the first line by setting the "Break at first line in PHP scripts" checkbox in PHP Storm. I just doesn't stop at my set break points.
Can anyone recommend what I need to do in order to get the break points to hit?

Related

Xdebug Client do not hit breakpoint

I try to configure Xdebug Client for Sublime Text 3 on Windows 10 (with PHP Version 7.3.0 and 2.7.0RC2 Xdebug version).
I read issues for days because the panels context were always blank, but I solved it adding "super_globals": false in Xdebug.sublime-settings.
Now the Xdebug Context show:
The problem is the breakpoint never hits. never show me the Steps options (into, over). Even, don't show the little yellow arrow on left side.
I believe that it's related to path_mapping configure, but this really confuse me.
I dont understand why I need configure path_mapping if I work only on localhost on xampp.
php.ini:
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug-2.7.0RC2-7.3-vc15.dll"
xdebug.remote_enable = 1
xdebug.remote_host = 127.0.0.1
xdebug.report_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_connect_back = 0
xdebug.idekey = sublime.xdebug
xdebug.trace_output_dir = "C:\xampp\tmp"
xdebug.remote_log = "C:\xampp\php\tmp\xdebug.log"
You might need to add xdebug.remote_autostart = 1. Per the XDebug documentation:
xdebug.remote_autostart Type: boolean, Default value: 0
Normally you need to use a specific HTTP GET/POST variable to start remote
debugging (see Remote Debugging). When this setting is set to 1,
Xdebug will always attempt to start a remote debugging session and try
to connect to a client, even if the GET/POST/COOKIE variable was not
present.
See: XDEBUG EXTENSION FOR PHP | DOCUMENTATION
Of course, restart your server after adding.
EDIT: See also Derick's answer on this StackOverflow page about using a log file to troubleshoot, if the above doesn't work.

XDebug is pausing just once

I'm using PHPStorm and Xdebug. I'm trying to debug a Web Application Project configured in my localhost. There are no symbolic links in my project path.
Below is Xdebug configuration in my php.ini:
[Xdebug]
xdebug.remote_port=9000
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.profiler_enable=1
xdebug.remote_host=localhost
xdebug.remote_handler=dbgp
xdebug.idekey = "PHPSTORM"
xdebug.profiler_output_dir="/tmp"
xdebug.remote_log="/tmp/xdebug.log"
zend_extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
Below are two variables exported in my zsh:
export PHP_IDE_CONFIG="serverName=localhost"
export XDEBUG_CONFIG="idekey=PHPSTORM"
Below is server configuration:
Below is debug configuration:
Below is the screenshot of first breakpoint where I see no variable values.
Below is the screenshot after 'Step In'. It shows: Waiting for incoming connection with ide key 'PHPSTORM'.
I get below message in event log:
Debug session was finished without being paused.
It may be caused by path mappings misconfiguration or not synchronized local and remote projects.
To figure out the problem check path mappings configuration for 'dev.sales-crm.com' server at PHP|Servers or enable Break at first line in PHP scripts option (from Run menu).
My problem is: after debugging is started, then control stops at first breakpoint. It shows no variables values. Then If I try to 'step into', then debugging stops.
Please help me. Below is the link to xdebug logs: xdebug.log
I upgraded my Xdebug version form Xdebug 2.5.0rc1 to Xdebug v2.5.0 and it started working.
Thank you very much.

Debugging Magento API Calls with XDebug

I have to debug an application (let's call it App A) that communicates with a Magento store through API v1 (via a Zend_XmlRpc_Client).
Here's how XDebug is configured on my php.ini.
xdebug.remote_enable = 1
xdebug.remote_host = 10.0.2.2
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.idekey=PHPSTORM
xdebug.trace_enable_trigger = 1
xdebug.trace_output_dir = "/var/www/xdebug_profile"
xdebug.profiler_enable_trigger = 1
;xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "/var/www/xdebug_profile"
xdebug.remote_log = "/var/www/xdebug_profile/xdebug.log"
When I go to my Magento store through my browser and enable debugging (using Xdebug chrome extension), I can debug my Magento store.
I would like to do the same thing from my App A. I want to access to my App A through my browser and be able to debug the Magento code that is executed through API calls. I tried to pass a cookie to the XML RPC client this way (following this article: http://inchoo.net/magento/magento-xdebug/ ) :
$xmlrpc_client->getHttpClient()->setCookie('XDEBUG_SESSION', 'PHPSTORM');
But it's not working. I also tried XDEBUG_SESSION_START for the cookie name, I tried to pass ?XDEBUG_SESSION_START=PHPSTORM at the end of the URL that my client calls and it's not working either.
FYI, I'm using a vagrant environment, both applications are using the same IP. Here's the content of my /etc/hosts file :
<my_vagrant_ip_address> dev.mysuperstore.com dev-app-a.mysuperstore.com
Any help is highly appreciated !
Just add ?XDEBUG_SESSION_START=filter_string at the end of the url
https://{{url_magento_test}}/rest/default/V1/task_blogext/posts?XDEBUG_SESSION_START=PHPSTORM
All you need to add for get working debug is to add this lines in xdebug.ini and to connect it:
zend_extension=xdebug
[xdebug]
xdebug.mode=debug
xdebug.client_port=9000
xdebug.client_host=host.docker.internal
xdebug.discover_client_host=1
After this, install chrome extension debug helper, and press in it debug mod. And all will work great.

Windows 8, Phpstorm 8, PHP 5.5 Xdebug not hitting breakpoints

I have recently bought a new computer. Previously I was running Windows 7 and PHPStorm 8 with PHP 5.5 (From WAMPServer) with XDebug 2.2.5. Everything was fine with this.
I am now on a new computer (Windows 8) with PHPStorm 8 and I cannot get XDebug to work correctly. I have not installed WAMPServer, but instead simply "lifted out" the PHP from my old hard disk. Maybe I should do this, but I wanted to avoid having the Apache server and MySQL as I don't want/need them on this computer.
Both installations (old and new) simply used the PHP Built-in web server for testing/debugging applications with.
I have been searching on Google and not found anyone else with a similar problem to mine neverless I have tried using multiple different snippets of configurations.
What happens
In my index.php I have added a phpinfo statement followed by die to simply spit out the PHP info and stop the application. I have put a breakpoint on the phpinfo line, and am expecting the IDE to pause here.
If I do Run > Debug > index.php (which launches a command line PHP session and simply executes index.php as a console app, the IDE does as expected and pauses at my breakpoint.
If I "Run" the Built-in web server, and hit localhost/index.php the IDE does not pause at my breakpoint although it does output the phpinfo.
It is behaving as though I have not pressed the telephone icon in PHPStorm, even though as I described in the console route it does pause at the breakpoint.
I confirm that the phpinfo output does indicate the XDebug is enabled and does reflect the settings in php.ini
php.ini extract
zend_extension = "c:/php/5.5/zend_ext/php_xdebug-2.2.5-5.5-vc11.dll"
[xdebug]
xdebug.remote_enable = on
xdebug.remote_host = 127.0.0.1
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/php/tmp"
xdebug.show_local_vars=0
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
xdebug.remote_mode=req
xdebug.remote_handler=dbgp
xdebug.remote_connect_back=0
xdebug.remote_autostart=0
xdebug.remote_log="C:/php/xdebug.log"
phpinfo output:
http://i.stack.imgur.com/hV8Rk.png
http://i.stack.imgur.com/GPf4o.png
I had even added in the xdebug.log bit to see what happens here, stopped and started the PHP Web server and tried the index.php call again, the log file was not created, so I have created it manually and granted full permissions in Windows. Tried the process again, and the file hasn't had any text added to it.
Text is added to the file, if I use that Run > Debug > index.php (console) route.
I think I am missing something ridiculous and obvious I just haven't a clue what it is.
Sorry for asking such a noob question, this is driving me mad!

PHP Remote Debugging using XDebug

I've got a lot of questions about how to debug php-files with xdebug and eclipse on a remote server.
What I would like to achieve is:
I have a remote server (with WAMPP (appache (Port 8502), php, mysql (Port 8501), etc)) and I would like to debug the php-files with Eclipse PDT from my local PC.
I prepared the following things:
Installed Eclipse PDT (Build id:
20100617-1415) on my local PC
Installed and activated xdebug on the
remote server (available at (lets
say) 111.111.111.111:8502) with the
following configuration within the
php.ini
[XDebug]
zend_extension = C:\TYPO3_4.4.6\php\ext\php_xdebug-2.1.0-5.3-vc6.dll
xdebug.profiler_output_dir = "C:/xampp/tmp/xdebug"
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_port=9000
xdebug.idekey=ECLIPSE_DBGP
xdebug.remote_log="C:\TYPO3_4.4.6\tmp\xdebug\xdebug_remote.log"
xdebug.show_exception_trace=0
xdebug.show_local_vars=9
xdebug.show_mem_delta=0
xdebug.trace_format=0
In Eclipse I added the server in
"Window - PHP - PHP Servers" with the
URL "http://111.111.111.111:8502" and
the Path Mapping - Path on Server:
"C:\TYPO3_4.4.6\htdocs" and Path in
Workspace: "/debug_test" (I created a
PHP Project named "debug_test").
I also changed the PHP - Debug to the following:
PHP-Debugger: XDebug
Server: 111.111.111.111
PHP Executable None Defined
Next I added the debug configuration (PHP Web Page):
Server Debugger: XDebug
PHP Server: 111.111.111.111
File: /debug_test/debug.php
Break at first line: off
Auto Generate: on
I created the file debug.php on the Remote Server at C:\TYPO3_4.4.6\htdocs\debug_test\ and within my PHP Project ("debug_test").
If I now run "Debug" and choose my Configuration File, the Webpage pops up (in an external browser) with the URL http://111.111.111.111:8502/debug_test/debug.php?XDEBUG_SESSION_STOP_NO_EXEC=ECLIPSE_DBGP&KEY=129657398681515 and the page is (fully) loaded as a normal page, but there is no way to debug it. Even If I switch to the PHP Debug - View and insert any breakpoints or things like this, there is nothing like debugging.
How do I get to the point that I can do remote debugging with xdebug and eclipse pdt?
Cheers,
Cheeesi
are you sure that your XDebug-Client / PC can be reached by 127.0.0.1 from your server?
B/c if I understand you correctly the your server is not installed on your PC. OTOH then I'm wondering about how you set up ypur XAMPP-system. B/c then usually all your stuff is locally installed.
Also the Browser's behaviour is important. If after invoking an XDebug-session through Eclipse your site is fully loaded, then your XDebug-Client in Eclipse couldn't reach your server. If you see your browser trying to load the page but it's stalling, then your client could tell the server to start an XDebug-session but your XDebug on the server couldn't connect back.
Your port 8502 that you specify for your server is also bit odd, but could be correct, given the corresponding configurations.
Best regards
Raffael
EDIT: and for a first try you should enable break on first line

Categories