Home » Php » php – How to stop Xdebug to stop debugging itself?

php – How to stop Xdebug to stop debugging itself?

Posted by: admin February 25, 2020 Leave a comment


I’m using Xdebug with Webgrind.
If I use below settings in php.ini, eveything works fine:

zend_extension = /usr/lib/php/20151012/xdebug.so
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = /var/www/html/xdebug

If I open webgrind by going to www.example.com/webgrind, cache.out files are shown and I can analyze everything fine.

If I use these settings where xdebug will be enabled for every url, cache.out files get generated but when I click on update in webgrind, it just keeps on loading. In my knowledge xdebug starts debugging process on this url as well because xdebug is enabled overall the site.

zend_extension = /usr/lib/php/20151012/xdebug.so
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /var/www/html/xdebug

How can I disable xdebug process when working inside the /webgrind directory but keep it enabled everywhere else?

I found this post where the second answer clearly mentions the same thing.
webgrind on wamp

In the Webgrind directory where you have extracted the code, add an
.htaccess file and put this content in it to avoid webgrind from
profiling itself:

php_flag xdebug.profiler_enable 0

I’ve a nginx+php-fpm setup, I’ve converted many .htaccess rules to nginx rewrite rules but not able to do the same with this.

How can I achieve the same with my setup or is there any other way I can get it working? Thank you!

How to&Answers:

You can use the .user.ini files that you can use as equivalence to .htaccess files. The .user.ini file should just contain the following: