Composer Issue + ” exceeded the timeout of 300 seconds “ 

GetComposer.org
GetComposer.org

I was installing this package from github and I came across the following issue:

– Installing doctrine/annotations (dev-master e93f3b7)
Cloning e93f3b718c421daddff58c4a4af1aee574472cd6
Failed to download doctrine/annotations from source: The process “git clone –no-checkout ‘git://github.com/doctrine/annotations.git’ ‘/var/www/pagekit.com/pagekit/vendor/doctrine/annotations’ && cd ‘/var/www/pagekit.com/pagekit/vendor/doctrine/annotations’ && git remote add composer ‘git://github.com/doctrine/annotations.git’ && git fetch composer” exceeded the timeout of 300 seconds.
Now trying to download from dist
– Installing doctrine/annotations (dev-master e93f3b7)
Loading from cache

I have tried to repeat this three times, but no success. By repeat I mean, first time $ composer install and then $ composer update

The Solution – Increase COMPOSER_PROCESS_TIMEOUT

Then I found the solution (after banging my head a bit) and I came across two worthwhile posts which set me on the right direction:

Based on these two alone, the possible solutions were:

  1. increase the COMPOSER_PROCESS_TIMEOUT – since composer by default set it to 300 secs (this is confirmed on the composer specs here itself)- as correctly suggested by my friend David Weinraub
  2. clear the composer’s cache or try adding -cache-dir=/dev/null IF the package is being loaded from composer’s cache

How To Diagnose the culprit?

It turns out that this command help a lot:
$ composer update  -vvv

A Better Solution – Use Satis

UPDATE:

My friend Hari KT on twitter suggested a better solution, that of using Satis (a Package Repository Generator) with composer. I’m yet to try this one out though.
You can find satis on github here: https://github.com/composer/satis

 Further Reading

This article is nice if you want to know how to use & understand Composer: Composer 101 by ServerGrove

 

 

I’m not yet so much versed with composer, this was only my 3rd practical encounter with Composer after watching NomadPHP‘s composer talks by Rafael Dohms (last year) and Beau Simensen (last year ). So if you have any more details or if you see you can add more to this, feel free to post a comment below.

Khayrattee Wasseem's Picture

About Khayrattee Wasseem

PHP enthusiast | The PHP Community Fanboi | Founder of PHP Usergroup for Mauritius (#PhpMauritius) | Aspiring Entrepreneur | Ex-country Manager of a global award winning Magento Agency | Passionate about all things Wordpress & Servers

Mauritius https://wppp.io

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.