Skip to content

Instantly share code, notes, and snippets.

@abdullahbutt
Created March 23, 2017 12:25
Show Gist options
  • Select an option

  • Save abdullahbutt/f007577a7918b896a09b84d20010d391 to your computer and use it in GitHub Desktop.

Select an option

Save abdullahbutt/f007577a7918b896a09b84d20010d391 to your computer and use it in GitHub Desktop.
composer timeout issue fix
How To Stop PHP Composer Timing Out When Using "composer update" or "composer install"
https://ilikekillnerds.com/2014/07/how-to-stop-php-composer-timing-out-when-using-composer-update-or-composer-install/
At work our internet connection is painfully slow for the moment while we sort something better out and I ran into a rather interesting quirk whilst using Composer and timeouts.
I was trying to install Laravel and because of the sheer number of components it got part of the way through and then would display some error message about exceeding the timeout limit of 300 seconds (5 minutes).
The reason for this appears to be due to the fact my Internet connection is mega slow and some components being largish in size. When calling composer update or composer install you just need to specify a higher timeout value.
This worked for me:
COMPOSERPROCESSTIMEOUT=6000 composer update
Obviously 6000 seconds will be enough time even for the slowest of Internet connections.
Composer Process Timeout When Fetching Large Repositories
http://www.papayasoft.com/2013/08/22/composer-process-timeout-when-fetching-large-repositories/
Yesterday I was doing a composer install from within my VM, but it kept timing out.
My first assumption was some network problem since my internet service is relatively slow and unreliable (at least compared to more developed places), especially from within my VM. But numerous tests suggested that my internet connectivity was ok.
Invoking Composer with the -vv verbose option showed me that it was failing while attemtping to clone the symfony/filesystem repo from GitHub. Cloning this repo directly, outside of the context of a composer install/update, succeeded. But it was a large repo and took a while.
All this suggested that Composer itself was imposing a limit on how long it would allow for the remote git operation. A look at the Composer documentation confirmed that the environment variable COMPOSER_PROCESS_TIMEOUT governs this. The variable is set to a default value of 300 (seconds) which was apparently not enough for a large clone operation using my slow internet connection. Raising this value using:
1
COMPOSER_PROCESS_TIMEOUT=2000 php composer.phar install
got me over the hump.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment