phpxdebug-3

php7.4 Xdebug xdebug.mode = debug is not working for me


I have installed Xdebug on a Ubuntu 20.04 system. I followed this documentation , which I found to be quite well written, and got everything installed per the specs. (I used apt rather than yum, and placed the .so file into /usr/lib/php/20190902 folder rather than the document's example.)

In that document, there is a reference to adding to the php.ini file (I added to /etc/php/7.4/apache2/php.ini and /etc/php/7.4/cli/php.ini files). Since the article doesn't specifically mention "sections" of the .ini file, I put them within the [PHP] section. (This is consistent with the remark about putting right before the Quick Reference bit.) I restarted Apache2 and the phpinfo() output now includes Xdebug, which it did not include before. All well and good.

The trouble I'm having is that although I set xdebug.mode = debug in the php.ini files, the phpinfo() output tells me that xdebug.mode is set to develop. Consequently, Step debugger shows as Disabled in my configuration. I cannot see why.

These are the lines I've added to each of those php.ini files:

zend_extension=xdebug.so

#zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.mode=debug,develop,trace

[xdebug]
xdebug.remote_host=localhost
xdebug.remote_connect_back=0
xdebug.remote_enable=1
xdebug.remote_port=9900
xdebug.idekey="PHPSTORM"
xdebug.remote_log="/tmp/xdebug.log"
xdebug.remote_handler=dbgp
xdebug.show_error_trace = 1
xdebug.log_level = 7
xdebug.start_with_request=yes
xdebug.mode=debug,develop,trace

And here are the key excerpts from the phpinfo() output:

enter image description here

On a whim, I tried placing all of those settings also within a new section of php.ini which I called [xdebug]. When that didn't work, I tried [Xdebug]. I restarted Apache2 after each attempt, but the symptom never changed.

What might I be missing?


Solution

  • You might be targeting incorrect php.ini please first verify you using PHP-fpm or php apache2 module

    if you are updating cli file the it won't work on as expected i believe you should update proper file

    sudo nano /etc/php/8.1/fpm/conf.d/20-xdebug.ini

    or

    sudo nano /etc/php/8.1/apache2/conf.d/20-xdebug.ini

    it's totally depends on you are using fpm but i think should change both wether you are using fpm or apache2 for safe side