如何通过 composer 在 laravel 安装期间禁用 xdebug
How to disable xdebug during laravel installation via composer
我正在使用 Composer 安装 laravel。但是在命令提示符屏幕中,显示了 "You are running composer with xdebug enable. This has a major impact on runtime performance." 这条消息。我想在 laravel 安装期间禁用 xdebug。如果我的系统中启用了 xdebug,会有什么问题吗?
[]
在使用 Composer 安装依赖项之前,您应该在控制台 php.ini
中暂时禁用 xdebug:
# Set xdebug autostart to false
xdebug.remote_autostart=0
xdebug.remote_enable=0
# Disable your profiller
xdebug.profiler_enable=0
并在 composer install
/composer update
完成后启用它。
此外,如果您不想在每次使用 Composer 时在 php.ini
中 enable/disable 它,您可以在控制台 PHP 文件中添加 xdebug_disable()
函数:
if (function_exists('xdebug_disable')) {
xdebug_disable();
}
我正在使用 Laravel Homestead,我创建了几个别名来快速转换 on/off Xdebug,并且我使用它们 before/after 繁重的作曲家命令,如下所示:
$ xdebug_off # Disable Xdebug
...
$ composer heavy-load stuff
...
$ xdebug_on # Enable Xdebug
...
进入框内后(在 vagrant ssh
之后),将这些别名添加到 ~/.profile
文件中:
# Xdebug aliases
alias xdebug_on='sudo phpenmod xdebug; sudo service php7.0-fpm restart;'
alias xdebug_off='sudo phpdismod xdebug; sudo service php7.0-fpm restart;'
如果你经常这样做,你可以使用我的快捷方式,在你的虚拟机上启动这个命令:
curl -LsS https://git.io/vrc3y >> ~/.profile; source ~/.profile
我正在使用 Composer 安装 laravel。但是在命令提示符屏幕中,显示了 "You are running composer with xdebug enable. This has a major impact on runtime performance." 这条消息。我想在 laravel 安装期间禁用 xdebug。如果我的系统中启用了 xdebug,会有什么问题吗?
[
在使用 Composer 安装依赖项之前,您应该在控制台 php.ini
中暂时禁用 xdebug:
# Set xdebug autostart to false
xdebug.remote_autostart=0
xdebug.remote_enable=0
# Disable your profiller
xdebug.profiler_enable=0
并在 composer install
/composer update
完成后启用它。
此外,如果您不想在每次使用 Composer 时在 php.ini
中 enable/disable 它,您可以在控制台 PHP 文件中添加 xdebug_disable()
函数:
if (function_exists('xdebug_disable')) {
xdebug_disable();
}
我正在使用 Laravel Homestead,我创建了几个别名来快速转换 on/off Xdebug,并且我使用它们 before/after 繁重的作曲家命令,如下所示:
$ xdebug_off # Disable Xdebug
...
$ composer heavy-load stuff
...
$ xdebug_on # Enable Xdebug
...
进入框内后(在 vagrant ssh
之后),将这些别名添加到 ~/.profile
文件中:
# Xdebug aliases
alias xdebug_on='sudo phpenmod xdebug; sudo service php7.0-fpm restart;'
alias xdebug_off='sudo phpdismod xdebug; sudo service php7.0-fpm restart;'
如果你经常这样做,你可以使用我的快捷方式,在你的虚拟机上启动这个命令:
curl -LsS https://git.io/vrc3y >> ~/.profile; source ~/.profile