Composer is a boon to Phper, but sometimes he will give us some small problems, such as the following error:
You is running composer with xdebug enabled. This have a major impact on runtime performance. See Https://getcomposer.org/xdebug
This is a very common conflict, and the impact of this conflict on the composer operation is quite large, and when we enable the Xdebug feature, we will slow down our composer run by 3-4 times. In other words: Xdebug is very important for our program debugging, but it increases memory footprint and process time for composer.
Composer's website gives a solution
Let me tell you about my troubleshooting ideas.
Method 1: Disable Xdebug globally through the PHP configuration file.
First of all, this is definitely a conflict caused by the Xdebug enabled, we want to find where Xdebug is enabled.
Write a page that contains the Phpinfo () function and open it in the browser.
Configuration parameters |
Value |
Configuration File (php.ini) Path |
/usr/local/etc/php/5.6 |
Loaded Configuration File |
/usr/local/etc/php/5.6/php.ini |
Scan this dir for additional. ini files |
/usr/local/etc/php/5.6/conf.d |
Additional. ini files parsed |
/usr/local/etc/php/5.6/conf.d/ext-igbinary.ini,/usr/local/etc/php/5.6/conf.d/ext-mcrypt.ini,/usr/local/etc/php /5.6/conf.d/ext-redis.ini,/usr/local/etc/php/5.6/conf.d/ext-xdebug.ini |
It is visible that PHP invokes all INI configuration files in the php.ini configuration file and the CONF.D directory.
Disable the "Xdebug" module in php.ini
Comment out the call statement with a semicolon:
; zend_extension = "/path/to/my/xdebug.so"
Removing Xdebug-related configuration files
If the Xdebug call is not in the main profile php.ini, then it is possible to expand the configuration folder, such as my environment, see table:
We can rename the Conf.d/ext-xdebug.ini to Ext-xdebug.bak or delete. This will not be called when the PHP service restarts. In person, we can also refer to the above steps, the corresponding Xdebug statements are commented out in Conf.d/ext-xdebug.ini, the effect is the same.
Method 2: Prevent calling Xdebug by setting an alias to composer
To set an alias you need to know which shell environment you are in, and my machine uses zsh, so edit the. zshrc file.
➜ ~ Cd➜ ~ VI. ZSHRC
Then choose a way to set your alias according to the following two scenarios, or set two aliases.
To invoke a configuration file that does not contain a Xdebug module
For Xdebug invocation in php.ini, we can create the following alias by copying a copy of the configuration file (Xdebug-disabled-php.ini) that does not contain Xdebug:
Alias comp= ' Php-c/path/to/xdebug-disabled-php.ini/path/to/composer.phar '
Do not invoke any PHP configuration file
This approach solves the situation where I have compiled some extended configuration paths into PHP like I did:
/path/to for your actual file or command path
OK, now we do the composer-v test, whether there are error prompts appear.
Good, perfect solution.
The above is to solve the Composer runtime Xdebug conflict content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!