Introduction
This is an article where the main topic is to discuss about how to solve an error. The error occurs while executing ‘composer -vvv install’. The command is actually has a specific purpose for building a project by downloading and installing the necessary modules defined in the composer.json file. In the context of this article, it is an attempt to build a web-based application using Laravel as its framework.
[user@hostname ~]# composer install ... [Symfony\Component\Process\Exception\ProcessTimedOutException] The process "git clone --no-checkout 'https://github.com/PHPOffice/PhpSpreadsheet.git' '/var/www/html/simpok/vendor/phpoffice/phpspreadsheet' && cd '/var/www/html/simpok/vendor/phpoffice/phpspreadshe et' && git remote add composer 'https://github.com/PHPOffice/PhpSpreadsheet.git' && git fetch composer" exceeded the timeout of 300 seconds.
Apparently, accoding to the output above, the process is stop. It is because the process take too long and it is exceeding the timeout limit. By default, the timeout limit for processing using the composer tool to build the entire application project is 300 seconds.
Implementing the Solution
The solution to this problem is normally increasing the timelimit value. The following command is how to increase the timeout limit of the composer process :
[user@hostname ~]# export COMPOSER_PROCESS_TIMEOUT=900
Since the value of the environment variable COMPOSER_PROCESS_TIMEOUT is only 300 by default, changing the value of it into a higher one is an alternatif solution. The above command execution is redefining the environment variable of COMPOSER_PROCESS_TIMEOUT and giving an new value into 900. After increasing the timeout value, try to execute once more. The execution is to build the vendor folder using the ‘composer’ command as follows :
[user@hostname ~]# composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Package operations: 39 installs, 0 updates, 0 removals - Installing phpoffice/phpspreadsheet (1.9.0): Downloading (0%) Downloading (10%) Downloading (5%) Failed to download phpoffice/phpspreadsheet from dist: Content-Length mismatch, received 289125 bytes out of the expected 4263446 Now trying to download from source - Installing phpoffice/phpspreadsheet (1.9.0): Cloning 8dea03eaf6 [Symfony\Component\Process\Exception\ProcessTimedOutException] The process "git clone --no-checkout 'https://github.com/PHPOffice/PhpSpreadsheet.git' '/var/www/html/simpok/vendor/phpoffice/phpspreadsheet' && cd '/var/www/html/simpok/vendor/phpoffice/phpspreadshe et' && git remote add composer 'https://github.com/PHPOffice/PhpSpreadsheet.git' && git fetch composer" exceeded the timeout of 900 seconds. install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] []... You have new mail in /var/spool/mail/root
Unfortunately, the time needed by composer process is still taking too long. Another attempt is taken by changing the value once more. This time, increasing the value from the previous one. The solution taken is by increasing the timelimit value once more as follows :
[root@hostname ~]# export COMPOSER_PROCESS_TIMEOUT=1600
After redefining the value of the environment variable COMPOSER_PROCESS_TIMEOUT, try to run the composer process once more as follows :
[root@hostname ~]# composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Package operations: 39 installs, 0 updates, 0 removals - Installing phpoffice/phpspreadsheet (1.9.0): Downloading (100%) - Installing maatwebsite/excel (3.1.17): Downloading (100%) - Installing scrivo/highlight.php (v9.15.10.0): Downloading (100%) - Installing filp/whoops (2.5.0): Downloading (100%) - Installing facade/ignition-contracts (1.0.0): Downloading (100%) - Installing facade/flare-client-php (1.0.4): Downloading (100%) - Installing facade/ignition (1.8.2): Downloading (100%) - Installing fzaninotto/faker (v1.8.0): Downloading (100%) - Installing hamcrest/hamcrest-php (v2.0.0): Downloading (failed) Downloading (100%) - Installing mockery/mockery (1.2.3): Downloading (100%) - Installing nunomaduro/collision (v3.0.1): Downloading (100%) - Installing webmozart/assert (1.5.0): Downloading (100%) - Installing phpdocumentor/reflection-common (2.0.0): Downloading (100%) - Installing phpdocumentor/type-resolver (1.0.1): Downloading (100%) - Installing phpdocumentor/reflection-docblock (4.3.2): Downloading (100%) - Installing phpunit/php-token-stream (3.1.1): Downloading (100%) - Installing sebastian/version (2.0.1): Downloading (100%) - Installing sebastian/type (1.1.3): Downloading (100%) - Installing sebastian/resource-operations (2.0.1): Downloading (100%) - Installing sebastian/recursion-context (3.0.0): Downloading (100%) - Installing sebastian/object-reflector (1.1.1): Downloading (100%) - Installing sebastian/object-enumerator (3.0.3): Downloading (100%) - Installing sebastian/global-state (3.0.0): Downloading (100%) - Installing sebastian/exporter (3.1.2): Downloading (100%) - Installing sebastian/environment (4.2.2): Downloading (100%) - Installing sebastian/diff (3.0.2): Downloading (100%) - Installing sebastian/comparator (3.0.2): Downloading (100%) - Installing phpunit/php-timer (2.1.2): Downloading (100%) - Installing phpunit/php-text-template (1.2.1): Downloading (100%) - Installing phpunit/php-file-iterator (2.0.2): Downloading (100%) - Installing theseer/tokenizer (1.1.3): Downloading (100%) - Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%) - Installing phpunit/php-code-coverage (7.0.8): Downloading (100%) - Installing doctrine/instantiator (1.2.0): Downloading (100%) - Installing phpspec/prophecy (1.8.1): Downloading (100%) - Installing phar-io/version (2.0.1): Downloading (100%) - Installing phar-io/manifest (1.0.3): Downloading (100%) - Installing myclabs/deep-copy (1.9.3): Downloading (connecting...) Downloading (100%) - Installing phpunit/phpunit (8.3.5): Downloading (100%) phpoffice/phpspreadsheet suggests installing dompdf/dompdf (Option for rendering PDF with PDF Writer) phpoffice/phpspreadsheet suggests installing jpgraph/jpgraph (Option for rendering charts, or including charts with PDF or HTML Writers) phpoffice/phpspreadsheet suggests installing mpdf/mpdf (Option for rendering PDF with PDF Writer) phpoffice/phpspreadsheet suggests installing tecnickcom/tcpdf (Option for rendering PDF with PDF Writer) filp/whoops suggests installing whoops/soap (Formats errors as SOAP responses) facade/ignition suggests installing laravel/telescope (^2.0) sebastian/global-state suggests installing ext-uopz (*) sebastian/environment suggests installing ext-posix (*) phpunit/php-code-coverage suggests installing ext-xdebug (^2.7.2) phpunit/phpunit suggests installing ext-soap (*) phpunit/phpunit suggests installing ext-xdebug (*) phpunit/phpunit suggests installing phpunit/php-invoker (^2.0.0) Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi Discovered Package: facade/ignition Discovered Package: fideloper/proxy Discovered Package: laravel/tinker Discovered Package: laravel/ui Discovered Package: maatwebsite/excel Discovered Package: nesbot/carbon Discovered Package: nunomaduro/collision Package manifest generated successfully. [root@hostname ~]#
As it appears in the above output command execution, the composer process finally can finish its step for downloading and building the entire project. At last the solution is just changing the environment variables of COMPOSER_PROCESS_TIMEOUT to match the composer process time limit. The solution to this problem is done by increasing the value of it to adjust the time needed by the composer process.