Why composer install timeouts after 300 seconds?

后端 未结 9 625
南笙
南笙 2020-12-02 08:15

I have small project made in symfony2 when I try to build it on my server it\'s always fails when unzipping symfony. Build was OK and suddenly composer won\'t unzip symfony

相关标签:
9条回答
  • 2020-12-02 08:48

    The easiest method is add config option to composer.json file, Add process-timeout 0, That's all. It works anywhere.

    {
      .....
      "scripts": {
        "start": "php -S 0.0.0.0:8080 -t public public/index.php"
      },
      "config": {
        "process-timeout":0
      }
    }
    
    0 讨论(0)
  • 2020-12-02 08:48

    Composer itself impose a limit on how long it would allow for the remote git operation. A look at the Composer documentation confirms that the environment variable COMPOSER_PROCESS_TIMEOUT governs this. The variable is set to a default value of 300 (seconds) which is apparently not enough for a large clone operation using a slow internet connection.

    Raise this value using:

    COMPOSER_PROCESS_TIMEOUT=2000 composer install
    
    0 讨论(0)
  • 2020-12-02 08:57
    composer config --global process-timeout 2000
    
    0 讨论(0)
  • 2020-12-02 08:59

    The Symfony Component has process timeout set to 60 by default. That's why you get errors like this:

    [Symfony\Component\Process\Exception\ProcessTimedOutException]     
    The process "composer update" exceeded the timeout of 60 seconds. 
    

    Solution

    Set timeout to 5 minutes or more

    $process = new Process("composer update");
    $process->setTimeout(300); // 5 minutes
    $process->run();
    
    0 讨论(0)
  • 2020-12-02 08:59

    old thread but new problem for me. No solutions here were working when trying to install google/apiclient (it failed on google/apiclient-services) on an Ubuntu VM within a Windows 10 host.

    After noticing Windows' "antimalware executable" taking up considerable CPU cycles when doing this composer install/update, I disabled "real-time protection" on the Windows 10 machine, and my composer update/install worked!!

    Hope that helps someone.

    0 讨论(0)
  • 2020-12-02 09:03

    It's an old thread but I found out the reason for time out was running a php debugger (PHPStorm was listening to xdebug connections) which caused the process timeout. When I closed the PHPStorm or disabled the xdebug extension, no time out occurred.

    0 讨论(0)
提交回复
热议问题