Reputation: 186
I have some AJAX queries executing repeatedly. So, if xdebug is running, I don't want to execute any of them.
Question is: how to determine in PHP code, whether xdebug is currently running?
Upvotes: 3
Views: 4800
Reputation: 1313
Run:
php -v
inside your command line.
If xDebug is running, you should get an extended string, something like:
with Xdebug v2.5.1, Copyright (c) 2002-2018, by Derrick Rethans
Upvotes: 0
Reputation: 922
From Xdebug v2.6 You can use the xdebug_is_debugger_active()
function: "Returns whether a debugging session is active" (from https://xdebug.org/docs/all_functions )
If you are not sure that Xdebug is even installed or enabled, check that first before calling this function or you can always use function_exists( 'xdebug_is_debugger_active' ) && xdebug_is_debugger_active()
as a condition.
Upvotes: 6