rramiii
rramiii

Reputation: 1186

Xdebug is always resetting session with phpStorm

Ether my status never came cross before or I don't know how to google it! my development environment got updated to ubuntu 14.04, phpStorm 2016.1 (still in trial version), java version "1.7.0_95". all settings are fine and I can debug, but after debugging start (a bout a minute or less), all debugging session gets terminates OR restarts from the first break point. also I get a lot of "Debug Session was finished without being paused" notice without making any debug request (see attached plz).

enter image description here

please let me know what to check or what could be the reason. Thanks in advance.


Update :

following is xdebug settings in php.ini

[xdebug] 
zend_extension="/usr/lib/php5/20121212/xdebug.so"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1

development framework is magento 1.14.2 EE

Upvotes: 8

Views: 10682

Answers (6)

rramiii
rramiii

Reputation: 1186

most of other answers are valid, but in my case it was incompatibility between PHP version and Xdebug version. so the solution for me was updating both PHP => PHP 7 & Xdebug to latest stable version. I felt like it's better to mention it in a separate answer in case anybody might come into same case.

update: xdebug 3.1.2 working settings:

config file path: /etc/php/8.1/mods-available/xdebug.ini settings:

zend_extension=xdebug.so
xdebug.mode=debug xdebug.start_with_request=yes
xdebug.client_host=127.0.0.1 xdebug.client_port=9003
xdebug.var_display_max_depth = -1 xdebug.var_display_max_children = -1
xdebug.var_display_max_data = -1 xdebug.idekey = "x_debug"

Upvotes: 0

JackTheKnife
JackTheKnife

Reputation: 4154

Go to PHPStorm - Settings -> Languages & Frameworks -> PHP -> Debug

... Section "External connections" -> "Break at first line in PHP scripts" ... disable this option

Additional suggestion:

... Section "Xdebug" -> disable the last two checkboxes ("Force break at first line...")

... Section "Advanced settings" -> disable "Notify if debug session was finished without being paused"

Upvotes: 2

Thornview
Thornview

Reputation: 151

You have the remote_autostart turned on, so every time you reload the page xDebug tries to debug the script, even if you weren't meaning to.

According to the documentation

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.

Set xdebug.remote_autostart = 0 and that should stop the errant messages about debugging.

Upvotes: 3

Luke
Luke

Reputation: 438

but after debugging start (a bout a minute or less), all debugging session gets terminates OR restarts from the first break point

I finally found a solution to this. My Apache configuration was set to terminate idle connections after 40 seconds - stopping the debug session and returning a 500 error to the client.

To fix this open your apache httpd.conf file and look for the following setting

LoadModule fcgid_module modules/mod_fcgid.so

If you are using this module, set or change the value of the following directive

FcgidIOTimeout 300

This setting defaults to 40 seconds if it is not specified, setting it to 300 will allow 5 minutes per connection before apache terminates it.

Upvotes: 0

Laurent
Laurent

Reputation: 1048

I'll quote a clear response from the official forums

You are right it's fine to have debug session without any breakpoints reached, e.g. it's common if you have Ajax request. The warning is intend to help new users to configure debugger. If "Break at first line" option is disabled and there's some error that silently prevent you to setup breakpoints (e.g. there's a typo in path mappings at PHP|Servers, remote and local file versions are not synchronized, etc) then nothing will happen on page reload. This situation is indistinguishable from xdebug misconfiguration (e.g. wrong "xdebug.remote_host", "xdebug.remote_port") therefore you may spend a lot of time to figure out the problem. The message is saying that debugger itself is configured correctly and suggest you next step in troubleshooting process.

If you have no problem and debug session without breakpoints is expected behavior then just disable it

Upvotes: 1

Michael Millar
Michael Millar

Reputation: 1604

You mention that you use php_fpm, so try running

sudo service php5-fpm restart

Upvotes: 0

Related Questions