Cómo desactivar XDebug


Creo que mi servidor se volvió lento desde que instalé XDebug. Por lo tanto, con el fin de probar mi hipótesis quiero desactivar XDebug completamente. He estado buscando tutoriales sobre cómo hacer esto, pero no puedo encontrar dicha información.

Author: Gordon, 2012-01-06

20 answers

Encuentra tu php.ini y busca XDebug.

Establecer el inicio automático de xdebug en false

xdebug.remote_autostart=0  
xdebug.remote_enable=0

Desactiva tu generador de perfiles

xdebug.profiler_enable=0

Tenga en cuenta que puede haber una pérdida de rendimiento incluso con xdebug desactivado pero cargado. Para deshabilitar la carga de la extensión en sí, necesita comentarla en su php.ini. Encuentra una entrada con este aspecto:

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

Y poner un ; para comentarlo, por ejemplo, ;zend_extension = ….

Echa un vistazo a este post XDebug, cómo desactivar la depuración remota para solo .archivo php?

 128
Author: Uday Sawant,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 12:18:21

Una solución fácil que funciona en distribuciones de Linux similares a Ubuntu

sudo php5dismod xdebug
sudo service apache2 restart
 88
Author: Arvi Võime,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-17 12:54:13

En Linux Ubuntu(tal vez también otro - no está probado) distribución con PHP 5 a bordo, puede utilizar:

sudo php5dismod xdebug

Y con PHP 7

sudo phpdismod xdebug

Y después de eso, reinicie el servidor:

sudo service apache2 restart
 26
Author: kkochanski,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-08-16 12:23:18

También puedes agregar xdebug_disable() a tu código. Try:

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

 23
Author: Zack Katz,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-01-08 18:20:20

Extensión de comentario en php.ini y reiniciar Apache. Aquí hay un script simple (puede asignarle un acceso directo)

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
Author: antonpinchuk,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-06-13 13:56:28

Cambié el nombre del archivo de configuración y reinicié el servidor:

$ 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

Funcionó para mí.

 10
Author: Sinan Eldem,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-03-04 09:43:28

En Windows (WAMP) en el archivo CLI ini:

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

Línea de comentario

; XDEBUG Extension

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

Apache procesará xdebug, y composer no.

 7
Author: Vladimir Vukanac,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-06-08 18:46:37

En xubuntu desactivé totalmente xdebug para la CLI con esto...

sudo rm /etc/php5/cli/conf.d/*xdebug*
 6
Author: Artistan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-05-08 13:10:41

Dos opciones:

1: Agregue el siguiente código en el Script de inicialización:

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

2: Agregue la siguiente bandera a php.ini

 xdebug.remote_autostart=0
 xdebug.remote_enable=0

Se recomienda la 1a opción.

 4
Author: Sumoanand,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-02-06 19:16:52

Encuentra tu PHP.ini y busca a XDebug.

Normalmente en Ubuntu su ruta es

/etc/php5/apache2/php.ini  

Haga los siguientes cambios (Mejor simplemente comentarlos agregando ; al principio)

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

Luego reinicie su servidor de nuevo para Ubuntu

sudo service apache2 restart
 4
Author: Shadab Salam,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-05-26 12:35:13

Me encontré con un problema similar. A veces, no encontrarás xdebug.so en php.ini. En cuyo caso, ejecute phpinfo() en un archivo php y verifique Additional .ini files parsed. Aquí verás más archivos ini. Uno de ellos será el archivo ini de xdebug. Simplemente elimine (o cambie el nombre) este archivo, reinicie apache y esta extensión se eliminará.

 3
Author: jerrymouse,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-10-12 00:20:34

Tuve el siguiente Problema: Incluso si establezco

xdebug.remote_enable=0 

Se mostró Xdebug-Error-Message-Decoration.

Mi solución:

xdebug.default_enable=0

Solo si uso esta bandera, Xdebug fue deshabilitado.

 3
Author: suther,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-12 11:38:01

(Esto es para CentOS)

Cambie el nombre del archivo de configuración y reinicie apache.

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

Haga lo contrario para volver a habilitar.

 3
Author: crmpicco,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-03-07 11:04:37

Desactivar xdebug

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

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

Luego comenta todo y guarda.


UPDATE Disable Disable solo para CLI

Según el comentario de @igoemon, este es un método mejor:

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

Nota: Actualiza la ruta a tu versión de PHP.

 3
Author: Justin,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-17 16:52:55

Ubuntu 16.04 elimina xdebug de PHP.

Encuentra tu php.archivo ini y asegúrese de que xdebug está allí:

grep -r "xdebug" /etc/php/

Esto podría llegar a diferentes versiones, si es así ejecute php -v para encontrar su versión.

Edite el php.archivo ini, como:

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

Comente la línea:

//zend_extension=xdebug.so

Guarde el archivo

 2
Author: Andrew Atkinson,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-10-25 14:23:02

Si está utilizando MAMP Pro en Mac OS X, se realiza a través del cliente MAMP desmarcando Active Xdebug en la pestaña PHP:

Desactivación de Xdebug en MAMP Pro

 1
Author: Casper André Casse,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-17 08:53:47

Así que, sí, todo lo que necesita, solo comente la línea en el archivo INI como zend_extension=xdebug.so o similar.

Los comentarios se pueden hacer añadiendo punto y coma.

Pero, este tipo de respuesta ya se ha añadido, y me gustaría compartir solución lista para cambiar el estado Xdebug.

He hecho quick switcher para Xdebug. Tal vez sería útil para alguien.

Conmutador Xdebug

 1
Author: Kirby,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-12 17:25:10

Para WAMP, haga clic con el botón izquierdo en el icono Wamp en la bandeja de la barra de tareas. Pase el cursor sobre PHP y luego haga clic en php.ini y ábrelo en tu editor de texto.

Ahora, busque la frase 'zend_extension' y agregue ; (punto y coma) delante de ella.

Reinicie el WAMP y estará listo.

 1
Author: bantya,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-09 12:41:59

Si está utilizando php-fpm lo siguiente debería ser suficiente:

sudo phpdismod xdebug
sudo service php-fpm restart

Tenga en cuenta que tendrá que ajustar esto dependiendo de su versión de php. Por ejemplo, ejecutando php 7.0 usted haría:

sudo phpdismod xdebug
sudo service php7.0-fpm restart

Dado que está ejecutando php-fpm, no debería ser necesario reiniciar el servidor web real. En cualquier caso, si no utiliza fpm, simplemente puede reiniciar su servidor web utilizando cualquiera de los siguientes comandos:

sudo service apache2 restart
sudo apache2ctl restart
 1
Author: Cyclonecode,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-09 13:14:56

Apache/2.4.33 (Win64) PHP / 7.2.4 myHomeBrew stack

Al final de php.ini Uso lo siguiente para administrar Xdebug para usar con 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
 1
Author: Jim,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-06-08 02:26:08