How to disable XDebug

I think my server has become slow since I installed XDebug. So, to test my hypothesis, I want to completely disable XDebug. I was looking for tutorials on how to do this, but I cannot find such information.

+113
php xdebug apc
Jan 6 2018-12-12T00:
source share
21 answers

Find php.ini and find XDebug.

Set xdebug autostart to false

 xdebug.remote_autostart=0 xdebug.remote_enable=0 

Disable your profiler

 xdebug.profiler_enable=0 

Please note that there may be a performance loss even with xdebug disabled but loaded . To disable downloading the extension itself, you need to comment on it in your php.ini. Find the entry that looks like this:

 zend_extension = "/path/to/php_xdebug.dll" 

and put a ; to comment on this, for example. ;zend_extension = …

Check this XDebug post , how to disable remote debugging for a single .php file?

+144
Jan 06 2018-12-12T00:
source share

A simple Linux distribution solution similar to Ubuntu

 sudo php5dismod xdebug sudo service apache2 restart 
+94
Apr 13 '15 at 11:30
source share

On Linux Ubuntu (perhaps one more - it has not been tested), the distribution with PHP 5 on board you can use:

 sudo php5dismod xdebug 

And with PHP 7

 sudo phpdismod xdebug 

And after that reboot the server:

 sudo service apache2 restart 
+33
Aug 16 '16 at 12:16
source share

Alternatively, you can add xdebug_disable() to your code. Try:

if(function_exists('xdebug_disable')) { xdebug_disable(); }

+23
Jan 08 '13 at 18:20
source share

I renamed the configuration file and restarted the server:

 $ mv /etc/php/7.0/fpm/conf.d/20-xdebug.ini /etc/php/7.0/fpm/conf.d/20-xdebug.i $ sudo service php7.0-fpm restart && sudo service nginx restart 

It worked for me.

+12
Mar 04 '16 at 9:43
source share

Comment extension in php.ini and restart Apache. Here is a simple script (you can assign a shortcut to it)

Xdebug-toggle.php

 define('PATH_TO_PHP_INI', 'c:/xampp/php/php.ini'); define('PATH_TO_HTTPD', 'c:/xampp/apache/bin/httpd.exe'); define('REXP_EXTENSION', '(zend_extension\s*=.*?php_xdebug)'); $s = file_get_contents(PATH_TO_PHP_INI); $replaced = preg_replace('/;' . REXP_EXTENSION . '/', '$1', $s); $isOn = $replaced != $s; if (!$isOn) { $replaced = preg_replace('/' . REXP_EXTENSION . '/', ';$1', $s); } echo 'xdebug is ' . ($isOn ? 'ON' : 'OFF') . " now. Restarting apache...\n\n"; file_put_contents(PATH_TO_PHP_INI, $replaced); passthru(PATH_TO_HTTPD . ' -k restart'); 
+10
Jun 13 '13 at 13:56 on
source share

on xubuntu I completely disabled xdebug for the CLI with this ...

 sudo rm /etc/php5/cli/conf.d/*xdebug* 
+9
May 08 '14 at 13:10
source share

On Windows (WAMP) in the INI CLI file:

X:\wamp\bin\php\php5.x.xx\php.ini

comment line

 ; XDEBUG Extension ;zend_extension = "X:/wamp/bin/php/php5.x.xx/zend_ext/php_xdebug-xxxxxx.dll" 

Apache will handle xdebug , but the composer will not.

+7
Jun 08 '15 at 18:46
source share

Two options:

1: add the following code to the script initialization:

  if (function_exists('xdebug_disable')) { xdebug_disable(); } 

2: add the following flag in php.ini

  xdebug.remote_autostart=0 xdebug.remote_enable=0 

The 1st option is recommended.

+4
Feb 06 '14 at 19:16
source share

Find your PHP.ini and find XDebug.

usually in ubuntu its way

 /etc/php5/apache2/php.ini 

Make the following changes (it’s better to just comment them, adding at the beginning)

 xdebug.remote_autostart=0 xdebug.remote_enable=0 xdebug.profiler_enable=0 

then restart the server again for Ubuntu

 sudo service apache2 restart 
+4
May 26 '16 at 12:35
source share

Disable xdebug

For PHP 7: sudo nano /etc/php/7.0/cli/conf.d/20-xdebug.ini

For PHP 5: sudo nano /etc/php5/cli/conf.d/20-xdebug.ini

Then comment out everything and save.




UPDATE - Disable for CLI only

According to @igoemon's comment, this is the best method:

PHP 7.0 (NGINX)

 sudo mv /etc/php/7.0/cli/conf.d/20-xdebug.ini /etc/php/7.0/cli/conf.d/20-xdebug.ini.old sudo service nginx restart 

Note. Update the path to your version of PHP.

+4
Jun 02 '16 at 16:06
source share

I had a similar problem. Sometimes you will not find xdebug.so in php.ini. In this case, execute phpinfo() in the php file and check Additional .ini files parsed . Here you will see more ini files. One of them will be the xdebug ini file. Just delete (or rename) this file, restart apache, and this extension will be removed.

+3
Oct 12 '14 at 0:20
source share

I had the following problem: Even if I installed

 xdebug.remote_enable=0 

Xdebug-Error-Message-Decoration has been shown.

My decision:

 xdebug.default_enable=0 

Only if I use this flag, Xdebug was disabled.

+3
May 12 '15 at 11:38
source share

(This is for CentOS)

Rename the configuration file and restart apache.

 sudo mv /etc/php.d/xdebug.ini /etc/php.d/xdebug.ini.old sudo service httpd restart 

Reverse to re-enable.

+3
Mar 07 '16 at 11:04 on
source share

Ubuntu 16.04 remove xdebug from PHP.

Locate the php.ini file and make sure xdebug:

 grep -r "xdebug" /etc/php/ 

This can lead to different versions if you run php -v to find your version.

Edit the php.ini file, for example:

 sudo vi /etc/php/5.6/mods-available/xdebug.ini 

Comment line:

 //zend_extension=xdebug.so 

Save file

+3
Oct 25 '17 at 14:23
source share

If you are using php-fpm should suffice:

 sudo phpdismod xdebug sudo service php-fpm restart 

Note that you will need to configure this depending on your version of PHP. For example, running php 7.0, you should do:

 sudo phpdismod xdebug sudo service php7.0-fpm restart 

Since you are using php-fpm, you do not need to restart the real web server. In any case, if you are not using fpm, you can simply restart your web server using any of the following commands:

 sudo service apache2 restart sudo apache2ctl restart 
+2
Mar 09 '18 at 13:14
source share

If you use MAMP Pro on Mac OS X, this is done through the MAMP client by unchecking the "Activate Xdebug" checkbox on the PHP tab:

Disabling Xdebug in MAMP Pro

+1
Jul 17 '15 at 8:53
source share

So yes, all you need is just select a line in the INI file, for example zend_extension=xdebug.so or similar.

Comments can be made by adding a semicolon.

But such an answer has already been added, and I would like to share a ready-made solution for switching the status of Xdebug.

I made a quick switch for Xdebug. Maybe that would be helpful for someone.

Xdebug switcher

+1
Jan 12 '17 at 17:25
source share

For WAMP, left-click on the Wamp icon in the taskbar. Hover over PHP and then click on php.ini and open it in a text editor.

Now find the phrase "zend_extension" and add; (semicolon) in front of it.

Restart WAMP and you will be fine.

+1
Apr 09 '17 at 12:41 on
source share

Apache / 2.4.33 (Win64) PHP / 7.2.4 stack myHomeBrew

At the end of php.ini, I use the following to control Xdebug for use with 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 (eg 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 
+1
Jun 08 '18 at 2:26
source share

Inspired by PHPStorm right click on file -> debug -> ...

 www-data@3bd1617787db:~/symfony$ php -dxdebug.remote_enable=0 -dxdebug.remote_autostart=0 -dxdebug.default_enable=0 -dxdebug.profiler_enable=0 test.php 

important -dxdebug.remote_enable=0 -dxdebug.default_enable=0 - -dxdebug.remote_enable=0 -dxdebug.default_enable=0

0
Jun 04 '19 at 10:05
source share



All Articles