Enable/disable xdebug through a2enmod and a2dismod?

5,515

I believe xdebug belongs to php and not apache per say so I saw this solution to disable it with [since your using] php 7:

sudo phpdismod xdebug

And for php 5:

sudo php5dismod xdebug

Then restarting apache after that: sudo systemctl restart apache2

Share:
5,515

Related videos on Youtube

Brian Gottier
Author by

Brian Gottier

Updated on September 18, 2022

Comments

  • Brian Gottier
    Brian Gottier over 1 year

    I don't remember how xdebug was enabled, but I found that in the /etc/php/7.0/mods-available directory xdebug is listed as xdebug.ini.

    If I go to the directory /etc/php/7.0/apache2/conf.d there is a symlink there to the xdebug.ini file, and that symlink is named 20-xdebug.ini.

    The contents of xdebug.ini is:

    zend_extension=xdebug.so
    

    xdebug is working, but because I am annoyed by it most of the time, I thought I could just turn it off:

    sudo a2dismod xdebug
    

    But that command barks at me, "ERROR: Module xdebug does not exist!". I would like it to be convenient to turn xdebug off and on whenever I want, so my questions are:

    • Since xdebug is on, why can't I use a2dismod to disable it?
    • Am I just doing this wrong, and should be doing it some other way?
    • Is the right thing to do to make an bash alias that does everything I need?

    I know I could just go in and comment out the line, then restart apache, but I need the lazy man's solution, if there is one.

  • Brian Gottier
    Brian Gottier over 6 years
    Thanks @George . Works perfectly. I think I'll make a little alias that turns it on/off and restarts apache.
  • matteo
    matteo about 6 years
    I can't suggest an edit to fix the typo "per say" which should read "per se", because there's an idiotic limitation on the minimum of characters an edit suggestion should contain. So, asking for somebody with enough reputation (or the author himself, I guess he is not subject to the restriction) to do the edit and fix the typo. I know, a comment to point out a typo is obnoxious and annoying, and that's precisely the point: I'm forced to do this because I'm not allowed to just suggest the edit.