最近 需要用到有盟的推送,不想自己寫,准備在github上面找個來改改,本地用的環境是docker 鏡像,然后在docker 中 composer 時的時候,報了一個錯
docker exec -it www /bin/bash
root@85c8ee9b5e27:/var/www/html/newyouchengdu# composer require lzg-xiyi/umengpush Do not run Composer as root/super user! See https://getcomposer.org/root for details Using version ^1.0 for lzg-xiyi/umengpush ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52 Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52
這個很明顯的內存溢出錯,怎么辦,肯定 是改不限制內存
https://stackoverflow.com/questions/49212475/composer-require-runs-out-of-memory-php-fatal-error-allowed-memory-size-of-161
然后找到了解決方案
root@85c8ee9b5e27:/var/www/html/newyouchengdu# php -d memory_limit=-1 /usr/local/bin/composer require lzg-xiyi/umengpush -vvv Reading ./composer.json Loading config file ./composer.json Checked CA file /etc/ssl/certs/ca-certificates.crt: valid