yhu420
yhu420

Reputation: 607

Disable XDebug at runtime

I'm trying to run my Symfony website with XDebug, and PHP sockets at the same time.

To run the website:

bin/console server:start

To run the sockets

bin/console sockets:start

My sockets will not start unless XDebug is disabled. However, I would like XDebug to be enabled for my website.

A solution is to disable XDebug system-wide in php.ini, but I would like to know if it is possible to do so at runtime, so I could unload XDebug before starting sockets when I run sockets:start.

Thank you!

Upvotes: 1

Views: 4224

Answers (2)

Martin Zeitler
Martin Zeitler

Reputation: 76639

just assign two different ports for the debugger in the xdebug.ini (the CLI has it's own) -

because it sounds alike, as if it would get stuck due not being able to bind the port.

... this additional port then needs to be set up in the IDE, too.

Upvotes: 1

Kiran Patel
Kiran Patel

Reputation: 379

To fix, before PHP 7 people would suggest to comment out the extension from php.ini file. However, in PHP 7 they are no longer in there.

Instead, we use the phpdismod command.

$ sudo phpdismod -s cli xdebug

The -s flag tells it to disable Xdebug for the CLI SAPI (/etc/php/7.0/cli) and not FPM.

And just like that, the warning message should be gone. No need to restart PHP

Upvotes: 1

Related Questions