Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use xdebug to debug only one virtual host?

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?

like image 304
Frantisek Avatar asked Mar 15 '13 02:03

Frantisek


People also ask

How does Xdebug remote work?

XDebug works over the protocol that requires your local machine to listen for incoming connections from a server where an application you are debugging is located. You may already have used debugging tools that simply connect to a remote server or a process of your application.

How does php Xdebug work?

When Xdebug is running, it will call back to your IDE (like PhpStorm or VS Code) from the server where it's running. Your IDE will sit and listen for that connection on a specific port (typically port 9000 or 9003).


1 Answers

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
like image 73
mkjasinski Avatar answered Sep 19 '22 17:09

mkjasinski