如何禁用XDebug

150

我认为自从安装了XDebug后,我的服务器变得很慢。因此,为了验证我的假设,我想完全禁用XDebug。我一直在搜索如何禁用它的教程,但是我找不到相关信息。

27个回答

3

仅针对特定的PHP版本或SAPI禁用xdebug。例如,在这种情况下需要禁用PHP 7.2 fpm中的xdebug。

sudo phpdismod -v 7.2 -s fpm xdebug
sudo service php7.2-fpm nginx restart

3
对于WAMP,点击任务栏托盘中的Wamp图标左键。将鼠标悬停在PHP上,然后单击php.ini并在文本编辑器中打开它。
现在,搜索短语“zend_extension”并在其前面添加;(分号)。
重启WAMP,就可以开始使用了。

2
如果你在Mac OS X上使用MAMP Pro,则可以通过MAMP客户端来完成此操作,在“PHP”选项卡下取消勾选“Activate Xdebug”:

Disabling Xdebug in MAMP Pro


2

所以,是的,你需要的一切,只需在INI文件中像zend_extension=xdebug.so或类似的地方添加注释即可。

可以通过添加分号来进行注释。

但是,这种回答已经被添加了,我想分享一个准备好的解决方案来切换Xdebug状态。

我为Xdebug制作了一个快速切换器。也许对某些人有用。

Xdebug Switcher


2

Apache/2.4.33 (Win64) PHP/7.2.4 myHomeBrew堆栈

在php.ini的末尾,我使用以下内容来管理Xdebug,以便与PhpStorm一起使用

; jch ~ Sweet analizer at https://xdebug.org/wizard.php for matching xdebug to php version.
; jch ~ When upgrading php versions check if newer xdebug.dll is needed in ext directory.
; jch Renamed... zend_extension = E:\x64Stack\PHP\php7.2.4\ext\php_xdebug-2.6.0-7.2-vc15-x86_64.dll

zend_extension = E:\x64Stack\PHP\php7.2.4\ext\php_xdebug.dll

; jch !!!! Added the following for Xdebug with PhpStorm

[Xdebug]
; zend_extension=<full_path_to_xdebug_extension>
; xdebug.remote_host=<the host where PhpStorm is running (e.g. localhost)>
; xdebug.remote_port=<the port to which Xdebug tries to connect on the host where PhpStorm is running (default 9000)>

xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000

xdebug.profiler_enable=1
xdebug.profiler_output_dir="E:\x64Stack\Xdebug_profiler_output"
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=1

; jch ~~~~~~~~~To turn Xdebug off(disable) uncomment the following 3 lines restart Apache~~~~~~~~~ 
;xdebug.remote_autostart=0  
;xdebug.remote_enable=0
;xdebug.profiler_enable=0

; !!! Might get a little more speed by also commenting out this line above... 
;;; zend_extension = E:\x64Stack\PHP\php7.2.4\ext\php_xdebug.dll
; so that Xdebug is both disabled AND not loaded

不要忘记重新启动 Apache 以加载 PHP 更改 (: - Sandra

1

对于那些想在Codeship中禁用它的人,请在运行测试之前运行此脚本:

rm -f /home/rof/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini

我收到了这个错误:
Use of undefined constant XDEBUG_CC_UNUSED - assumed 'XDEBUG_CC_UNUSED' (this will throw an Error in a future version of PHP)

现在已经消失了!


0

在CLI中:

sudo phpdismod xdebug

禁用 xdebug

sudo phpenmod xdebug

启用 xdebug

然后重新启动服务器


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接