11

I have installed xdebug, I can see in phpinfo() that it's installed (but it's OFF).

However, I don't want to enable it for the whole server/apache2, I just want to enable it for one virtual host.

How can I do this?

Frantisek
  • 7,485
  • 15
  • 59
  • 102

1 Answers1

16

You can set xdebug in php.ini with off value:

zend_extension=/usr/lib/php/modules/xdebug.so
xdebug.remote_enable off
xdebug.remote_port 9000
xdebug.idekey PHP-XDEBUG

and turn on only .htaccess with directive:

php_flag   xdebug.remote_enable on
mkjasinski
  • 3,115
  • 2
  • 22
  • 21
  • The line `php_value zend_extension=/usr/lib/php/modules/xdebug.so` is incorrect. It should read `php_value zend_extension /usr/lib/php/modules/xdebug.so` which will not work either. You can not load a PHP extension in a `.htaccess` file. – Mehran Jul 17 '13 at 12:10
  • 1
    Only `php_flag xdebug.remote_enable on` in `.htaccess` file. – mkjasinski Jul 17 '13 at 20:24
  • 1
    This does not disable xdebug completely, just remote debugging. Is there a way to disable it completely for the hosts where it's not needed? Usecase: the mere presence of xdebug makes it impossible to report errors to NewRelic – matteo Apr 30 '18 at 17:09