PHP composer xdebug警告 [英] PHP composer xdebug warning

查看:346
本文介绍了PHP composer xdebug警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PHP新手。工作在一个PHP项目,并启用xdebug能够调试我的PHP应用程序。生产服务器未启用xdebug,因为它由另一个团队处理。在我的本地机器上,当我运行composer它给我一个警告说

 你正在运行composer启用xdebug。这对
运行时性能有重大影响。

我不想在开发时禁用xdebug。只是想确认在开发环境中运行xdebug应该对编译器在生产服务器上安装应用程序的库/性能有没有影响

解决方案


我不想在开发时禁用xdebug。只是想确认在开发环境中运行xdebug应该对编译器在生产服务器上安装应用的库/性能有无影响


只是加载Xdebug有一个巨大的影响。它会将Composer运行速度降低3倍或4倍,即使未启用分析功能也是如此。



换句话说:xdebug对于调试是无价的,但增加了Composer的内存使用和处理时间。






如何为Composer运行禁用Xdebug?



我的建议是写一个小调用



帮助程序是一个bash或批处理脚本,使用自定义 php.ini 特别配置为Composer。让我们称之为 php.ini-composer



.ini ,并通过删除xdebug或将其注释掉来调整Composer运行:; zend_extension =/path/to/my/xdebug.so / code>。



当您处于设置状态时: memory_limit = -1
$ b

完整命令在Windows上的样子如下: php.exe -c php.ini-composer composer.phar%*



只需克隆一个bash脚本的想法。






在作曲家常见问题中完全回答您的问题。



https://getcomposer.org/doc/articles/troubleshooting.md#xdebug-impact-on-composer








还提到一些替代方法(而不是使用独立的ini文件)此处


New to PHP. Working on a PHP project and have xdebug enabled to be able to debug my php applications. The production server does not have xdebug enabled because it is handled by another team. On my local machine, when I run composer it gives me a warning saying

You are running composer with xdebug enabled. This has a major impact on 
runtime performance.

I do not want to disable xdebug when I am developing. Just wanted to confirm that running xdebug in dev environment should have no impact on the composer installing libraries/performance of the app on the production server.

解决方案

I do not want to disable xdebug when I am developing. Just wanted to confirm that running xdebug in dev environment should have no impact on the composer installing libraries/performance of the app on the production server.

There is a huge impact of just loading Xdebug. It slows the Composer run down by 3x or 4x, even when the profiling feature is not enabled.

In other words: xdebug is invaluable for debugging, but increases the memory used and processing time of Composer.


How to disable Xdebug for Composer runs?

My suggestion is to write a little invocation helper for running Composer.

The helper is a bash or batch script calling PHP with a custom php.ini, especially configured for Composer. Lets call it: php.ini-composer.

You could copy your current php.ini and adjust it for the Composer run, by removing xdebug or commenting it out, like so: ;zend_extension = "/path/to/my/xdebug.so".

While you are at it: setting memory_limit=-1 is helpful, too.

The full command looks like so on Windows: php.exe -c php.ini-composer composer.phar %*

Just clone the idea for a bash script.


And you may find the full answer to your question in the Composer FAQ.

https://getcomposer.org/doc/articles/troubleshooting.md#xdebug-impact-on-composer

It was added/updated just a few hours ago.


Some alternatives (instead of using seperate ini file) are also mentioned here.

这篇关于PHP composer xdebug警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆