Как удалить xdebug ubuntu

Обновлено: 06.07.2024

Я думаю, что мой сервер стал медленным, так как я установил XDebug. Итак, чтобы проверить мою гипотезу, я хочу полностью отключить XDebug. Я искал уроки о том, как это сделать, но я не могу найти такую информацию.

найти php.ini и искать XDebug.

установите автозапуск xdebug в false

обратите внимание, что может быть потеря производительности даже при отключенном xdebug, но загруженном. Чтобы отключить загрузку самого расширения, вам нужно прокомментировать его в своем php.ini. Найдите запись, которая выглядит так:

и поставить ; комментировать это, например, ;zend_extension = … .

простое решение, работающее на дистрибутивах Linux, подобных Ubuntu

на Linux Ubuntu(может быть, еще один - он не тестируется) распределение с PHP 5 на борту, вы можете использовать:

и PHP 7

и после этого, пожалуйста, перезагрузите сервер:

кроме того, вы можете добавить xdebug_disable() в ваш код. Попробуйте:

расширение комментариев в php.ini и перезапустить Apache. Вот простой скрипт (вы можете назначить ему ярлык)

отладчик xdebug-тумблер.в PHP

я переименовал файл config и перезапустить сервер:

это сработало для меня.

В Windows (WAMP) в файле CLI ini:

Apache будет обрабатывать xdebug , и композитор не будет.

в xubuntu я полностью отключил xdebug для CLI с этим.

1: добавьте следующий код в скрипт инициализации:

2: Добавьте следующий флаг в php.ini

найдите свой PHP.ini и ищите XDebug.

обычно в Ubuntu его путь

внесите следующие изменения (лучше просто прокомментировать их, добавив ; в начале )

затем перезапустите сервер опять же для Ubuntu

я столкнулся с аналогичной проблемой. Иногда вы не найдете xdebug.так в php.ini. В этом случае выполните phpinfo() в файле php и проверьте Additional .ini files parsed . Здесь вы увидите больше ini-файлов. Одним из них будет ini-файл xdebug. Просто удалите (или переименуйте) этот файл, перезапустите apache, и это расширение будет удалено.

у меня была следующая проблема: Даже если я установлю

только если я использую этот флаг, Xdebug был отключен.

переименуйте файл конфигурации и перезапустите apache.

сделайте обратное, чтобы снова включить.

отключить xdebug

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

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

затем прокомментируйте все и сохраните.

UPDATE -- Disable для CLI только

согласно комментарию @igoemon, это лучший метод:

Примечание: обновите путь к вашей версии PHP.

найдите свой php.ini-файл и убедитесь, что xdebug есть:

это может придумать разные версии, если так запустить php -v найти свой вариант.

редактировать php.файл ini, например:

комментарий строка:

сохраните файл

Если вы используете MAMP Pro на Mac OS X, это делается через клиент MAMP, сняв флажок Активировать Xdebug под PHP tab:

Disabling Xdebug in MAMP Pro

Итак, да, все, что вам нужно, просто прокомментируйте строку в INI-файле, как zend_extension=xdebug.so или аналогичные.

комментарии можно сделать, добавив точку с запятой.

но такой ответ уже добавлен, и я хотел бы поделиться готовым решением для переключения статуса Xdebug.

Я сделал быстрый переключатель для Xdebug. Может быть, это кому-то пригодится.

для WAMP щелкните левой кнопкой мыши значок Wamp в панели задач. Наведите курсор на PHP, а затем нажмите на php.ini и откройте его в своем texteditor.

теперь найдите фразу "zend_extension" и добавьте ; (точка с запятой) перед ней.

перезагрузите WAMP, и вы хорошо идти.

если вы используете php-fpm должно быть достаточно следующего:

обратите внимание, что вам нужно изменить в зависимости от вашей версии PHP. Например, при запуске php 7.0 вы бы сделали:

поскольку вы используете php-fpm, нет необходимости перезапускать фактический веб-сервер. В любом случае, если вы не используете fpm, вы можете просто перезапустить свой веб-сервер, используя любую из приведенных ниже команд:

When running composer diagnose , I get the following error :

The xdebug extension is loaded, this can slow down Composer a little. Disabling it when using Composer is recommended.

How can I disable xdebug only when I'm running Composer?

11.1k 7 7 gold badges 42 42 silver badges 59 59 bronze badges 21.5k 15 15 gold badges 68 68 silver badges 96 96 bronze badges

18 Answers 18

Update: For Xdebug 3+:

As of Xdebug 3, it is possible to disable the Xdebug completely by setting the option xdebug.mode to off , or by setting the environment variable XDEBUG_MODE=off .

It is very easy to disable Xdebug just for composer, by aliasing composer .

You can add the alias to your $HOME/.bashrc to make it permanent.

Update: For Xdebug 1.3 - 3.0.0 :

The issue has been fixed in Composer 1.3. Update composer to the latest version by executing composer self-update , instead of trying the following workaround.

For Xdebug < 1.3

Here is my modification of @ezzatron's code. I have updated the script to detect ini files from phpinfo output.

17k 11 11 gold badges 59 59 silver badges 88 88 bronze badges This is by far the most elegant solution to the problem, IMHO. Thanks Joyce! You can confirm that you are running the latest version by running composer self-update New composer version definitely still has this issue, at least in my docker container it does

This command will disable the PHP5 Xdebug module for CLI (and thus composer) :

It removes the xdebug.ini symlink from /etc/php5/cli/conf.d/

Note that for Ubuntu 16.04 you probably need to run it like this:


5,989 4 4 gold badges 27 27 silver badges 57 57 bronze badges 950 1 1 gold badge 6 6 silver badges 4 4 bronze badges thanks for this :) but I have ubuntu 16.04 and if someone will need to use this just run sudo phpdismod -s cli xdebug How about php7 in ubuntu? Do I only need to remove the symlink ? /etc/php/7.0/cli/conf.d

I don’t think there is an option to configure PHP so it can load different configurations according to the targeted script. At least, not without duplicating .ini files.

However, you can add thoses options when running composer with php:

-n will tell PHP to ignore any php.ini. This will prevent xdebug from loading for this very command.

-d options permits you to add any option you want (for exemple, activate needed_ext.so). You can use multiple -d options. Of course, this is optional, you might not need it.

Then you can create an alias, to make it sugary again.

A typical solution (because composer needs json):

greg0ire > my solution, based on that:

It looks ugly (I tried and failed to do that with xargs), but works… I had to disable some extensions though, otherwise I get the following warnings:


The problem with this whitelist approach, though, is that the whitelist might grown depending on what people require in their composer.json , for instance "ext-ldap" : "*", or simply depending on what is needed to make the post install tasks run properly… If only there were a way to blacklist an extension… It comes to my mind, but, I assume you use xdebug in a development environment. Is composer so slow that it needs this tweak?

By creating an alias you'll suppress that composer xdebug error message.

Just add this line to your

/.bash_aliases within your system and it should work flawlessly.

Reload the shell to make the new alias composer available.

NOTE:
You don't necessarily need to use any other parameter.
Depending on your system you might have a .bashrc instead of .bash_profile .

UPDATE:

As @AlexanderKachkaev mention in the comments it's worth nothing to add the memory_limit as follows to avoid crashing im some situations:


7,015 1 1 gold badge 23 23 silver badges 25 25 bronze badges The -n option disables Phar extension so it may fail to run from composer.phar This solution is pretty simple and workable for my situation. The memory limit suggestion from @AlexanderKachkaev is a must. Be good to edit the answer.

You can disable Xdebug setting an environment variable:

It's available using XDebug 3.

21.5k 15 15 gold badges 68 68 silver badges 96 96 bronze badges


1,211 1 1 gold badge 12 12 silver badges 11 11 bronze badges

I came up with an answer that works pretty well for OSX, and could probably be adapted for any PHP version that loads its extensions using individual .ini files in the "additional ini dir":

Fantastic, works fine on Mac OS, on brew installed php 7.1. TY!

I usually create a shell script per project, since every project has another PHP version. It's in a /bin/ directory next to composer.phar and composer.json and I run it as ./bin/composer in my project directory.

It looks like this (for php56)

The -d options effectively disable xdebug. The COMPOSER_DISABLE_XDEBUG_WARN=1 part disables the warning composer issues.

Disabling the xdebug extension is preferred (see composer troubleshooting), but I personally like the simpler script.

Some timings on my machine: 2 Run with xdebug and ini-enabled: 1m33

Run with xdebug but ini-disabled: 0m19

Run without xdebug: 0m10

I think since you are disabling XDebug, you do not need the COMPOSER_DISABLE_XDEBUG_WARN=1 : if you get a warning, it just means your scrit does not work. Defining xdebug.remote_autostart seems useless if remote debugging is disabled. Ok so there is an improvement anyway. Not the best available improvement, but a huge improvement nonetheless (at least on OS X)

If you use PHPStorm, the latest release (2016.2) comes with a feature to enable XDebug for CLI scripts on-demand, which means you can simply turn off XDebug globally on your development machine. The IDE will enable it on the fly when it is needed by code inside your projects.

PhpStorm 2016.2 introduces Xdebug On Demand mode where you can disable Xdebug for your global PHP install, and PhpStorm will only enable it when it needs to — when you’re debugging your scripts, or when you need code coverage reports.

You need to edit your PHP Interpreters preferences to include the path to XDebug, as described in the linked article.

To me this seems like the perfect solution, as I only usually want XDebug while I'm in the IDE.

I think that my server became slow since I installed XDebug. So, in order to test my hypothesis I want to disable XDebug completely. I've been searching for tutorials on how to do this but I can't find such information.


301k 68 68 gold badges 513 513 silver badges 536 536 bronze badges


3,026 3 3 gold badges 25 25 silver badges 35 35 bronze badges

25 Answers 25

Find your php.ini and look for XDebug.

Set xdebug autostart to false

Disable your profiler

Note that there can be a performance loss even with xdebug disabled but loaded. To disable loading of the extension itself, you need to comment it in your php.ini. Find an entry looking like this:

and put a ; to comment it, e.g. ;zend_extension = … .

8,608 2 2 gold badges 41 41 silver badges 48 48 bronze badges 5,491 3 3 gold badges 31 31 silver badges 44 44 bronze badges Thanks! I found that my problem was APC, my memory was low apparently. You are right, xdebug is part of PHP, not a module of Apache. Now everything is running fine. @HaralanDobrev Check phpinfo() to see if xdebug is actually enabled. if it is, check if you have any additional ini files attached to php.ini file. Additionally make sure you are editing correct ini file. it is possible to have these files at multiple locations.

An easy solution working on Linux distributions similar to Ubuntu

7,033 8 8 gold badges 42 42 silver badges 70 70 bronze badges


1,047 1 1 gold badge 7 7 silver badges 2 2 bronze badges Could you please elaborate more your answer adding a little more description about the solution you provide? That command is for ubuntu not centOS. Should provide that explanation because you are not the only person use the same linux distro. this is for apache2 and not for CLI. These might have different php.ini files Depending of your PHP version, you should enter $ sudo phpdismod xdebug

In Linux Ubuntu(maybe also another - it's not tested) distribution with PHP 5 on board, you can use:

And with PHP 7

And after that, please restart the server:


PHP 7 removed xdebug from the ini file, I believe. So this answer helped me. php -v; phpdismod -v 7.4 xdebug; Change 7.4 to php version according to echo first command.

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

This only disables displaying stacktraces, it does not actually disable xdebug (terribly named function, I know)

I renamed the config file and restarted server:

It did work for me.

4,902 3 3 gold badges 33 33 silver badges 36 36 bronze badges This worked for me, except in /etc/php/7.0/cli/conf.d instead of /etc/php/7.0/fpm/conf.d This will also work on php 7.2,9 on mac osx or on centos vagrant. Just rename to xdebug.ini to xdebug.ini.old or something else For the non-fpm PHP: sudo mv /etc/php/7.4/apache2/conf.d/20-xdebug.ini /etc/php/7.4/apache2/conf.d/20-xdebug.ini.bak

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


in xubuntu I totally disabled xdebug for the CLI with this.

note: this really helped me out for composer updates. needed to disable xdebug for performance issues. Worth mentioning if you run php script from terminal that runs another php script from terminal via passthru function with xdebug enabled, xdebug might hang and stop the execution.

On Windows (WAMP) in CLI ini file:

Apache will process xdebug , and composer will not.


If you are using php-fpm the following should be sufficient:

Notice, that you will need to tweak this depending on your php version. For instance running php 7.0 you would do:

Since, you are running php-fpm there should be no need to restart the actual webserver. In any case if you don't use fpm then you could simply restart your webserver using any of the below commands:

Я думаю, что мой сервер стал медленным, так как я установил XDebug. Итак, чтобы проверить мою гипотезу, я хочу полностью отключить XDebug. Я искал уроки о том, как это сделать, но я не могу найти такую информацию.

найти php.ini и искать XDebug.

установите автозапуск xdebug в false

отключить профайлер

обратите внимание, что там может быть потеря производительности даже при отключенном xdebug, но загруженном. Чтобы отключить загрузку самого расширения, вам нужно прокомментировать его в своем php.Ини. Найдите запись, которая выглядит так:

и поставить ; чтобы прокомментировать его, например ;zend_extension = … .

проверить это пост XDebug, как отключить удаленную отладку для одного .файл php?

простое решение, работающее на дистрибутивах Linux, подобных Ubuntu

на Linux Ubuntu(может быть, и другой - это не проверено) распределение с PHP 5 на борту, вы можете использовать:

и PHP 7

и после этого, пожалуйста, перезагрузите сервер:

кроме того, вы можете добавить xdebug_disable() в ваш код. Попробуйте:

if(function_exists('xdebug_disable'))

расширение комментария в php.ini и перезапустить Apache. Вот простой скрипт (вы можете назначить ему ярлык)

отладчик xdebug-тумблер.php

я переименовал файл config и перезапустить сервер:

это действительно сработало для меня.

на Windows (WAMP) в файле CLI ini:

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

строки

Apache будет обрабатывать xdebug , и композитор не будет.

в xubuntu я полностью отключил xdebug для CLI с этим.

два варианта:

1: добавьте следующий код в скрипт инициализации:

2: Добавьте следующий флаг в php.ini

1-й вариант.

найдите свой PHP.ini и искать XDebug.

обычно в Ubuntu его путь

внесите следующие изменения (лучше просто прокомментировать их, добавив ; в начале )

затем перезагрузите ваш сервер опять же для Ubuntu

я столкнулся с аналогичной проблемой. Иногда, вы не найдете xdebug.so в php.Ини. В этом случае выполните phpinfo() в php-файле и проверьте Additional .ini files parsed . Здесь вы увидите больше ini-файлов. Одним из них будет ini-файл xdebug. Просто удалите (или переименуйте) этот файл, перезапустите apache, и это расширение будет удалено.

(Это для CentOS)

переименуйте конфигурационный файл и перезапустите apache.

сделайте обратное, чтобы снова включить.

отключить xdebug

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

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

затем закомментируйте все и сохраните.

обновление -- отключить только для CLI

согласно комментарию @igoemon, это лучший метод:

PHP 7.0 (NGINX)

Примечание: обновите путь к вашей версии PHP.

найдите свой php.ini-файл и убедитесь, что xdebug есть:

это может придумать разные версии, если так запустить php -v найти свой вариант.

редактировать php.файл ini, например:

комментарий строка:

сохраните файл

Disabling Xdebug in MAMP Pro

Если вы используете MAMP Pro на Mac OS X, это делается через клиент MAMP, сняв флажок Активировать Xdebug под PHP tab:

Итак, да, все, что вам нужно, просто прокомментируйте строку в INI-файле, например zend_extension=xdebug.so или аналогичные.

комментарии можно сделать, добавив точку с запятой.

но, такой ответ уже добавлен, и я хотел бы поделиться готовым решением для переключения статуса Xdebug.

Я сделал быстрый переключатель для Xdebug. Может быть, было бы полезно для кого-то.

Xdebug Switcher

для WAMP щелкните левой кнопкой мыши на значке Wamp в панели задач. Наведите курсор на PHP, а затем нажмите на php.ini и откройте его в своем текстовом редакторе.

теперь найдите фразу 'zend_extension' и добавьте ; (точка с запятой) перед ней.

перезагрузите WAMP, и вы хорошо идти.

если вы используете php-fpm должно быть достаточно следующего:

обратите внимание, что вам нужно изменить в зависимости от вашей версии PHP. Например, запустив php 7.0 вы бы сделали:

поскольку вы используете php-fpm, не должно быть необходимости перезапускать фактический веб-сервер. В любом случае, если вы не используете fpm, вы можете просто перезапустить свой веб-сервер, используя любую из следующих команд:

Apache / 2.4.33 (Win64) PHP/7.2.4 myhomebrew stack

В конце php.Ини я использую следующие действия, чтобы управлять отладчик xdebug для работы с PhpStorm именно

Читайте также: