Composer hanging while updating dependencies

JsonComposer PhpHamcrest

Json Problem Overview

I tried updating a Laravel project I'm working on today using composer update

But it hung on Updating dependencies (including require-dev)

So I tried things like updating composer, dump-autoload, but nothing seemed to work. Then I ran it in verbose mode: composer update -vvv

And I noticed it hung while reading this json:

Reading path/to/Composer/repo/$hamcrest-php.json from cache

I tried searching for cordoval/hamcrest-php on and couldn't find it. This isn't listed as a dependency in my composer.json

Searching through my vendor folder, I notice the mockery/mockery package I use requires hamcrest/hamcrest-php, but I can't find anything that makes any reference to cordoval.

Any idea what's wrong and how I can fix it so that I can do the update?

Here's my composer.json:

    "name": "laravel/laravel",
	"description": "The Laravel Framework.",
	"keywords": ["framework", "laravel"],
	"license": "MIT",
	"require": {
		"laravel/framework": "4.2.*",
		"iron-io/iron_mq": "dev-master",
		"phpunit/phpunit": "4.2.*",
		"mockery/mockery": "dev-master",
		"xethron/migrations-generator": "dev-master",
		"mailgun/mailgun-php": "dev-master"
	"autoload": {
		"classmap": [
	"scripts": {
		"post-install-cmd": [
			"php artisan clear-compiled",
			"php artisan optimize"
		"post-update-cmd": [
			"php artisan clear-compiled",
			"php artisan optimize"
		"post-create-project-cmd": [
			"php artisan key:generate"
	"config": {
		"preferred-install": "dist"
	"minimum-stability": "stable"


I've tried removing some of the packages from my composer.json, including the "mockery/mockery" package. The only change it made was that Composer would hang on a different file.

After leaving Composer running like that for quite a long time, it finally exited with an error such as the following:

/path/to/ComposerSetup/bin/composer: line 18:  1356 Segmentation fault      php "${dir}/composer.phar" $*

Not sure what to do about that...

Json Solutions

Solution 1 - Json

In my case, it was simply taking a very long time on my 8GB ram Mac. To check the progress and verify that it is going through the dependencies, run composer in verbose mode. This was an approach I missed in the question so worth re-stating here.

composer update -vvv

Solution 2 - Json

So it turns out the problem was with php's xdebug extension. After disabling it in my php.ini, composer ran without any problems.

And just to note, the hang-up wasn't actually occurring while reading files from the cache. It was the step right after where composer was trying to resolve dependencies. It just never finished that step and never printed the output. That's why no matter what I did, it always appeared to be stuck reading a file from the cache.

Solution 3 - Json

1st of all : Check firewall and proxy connections. If everything is ok but composer is still hanging try to clear composer cache:

composer clear-cache

2nd option If these steps does not repair your composer then it's possible that the system does not have enough RAM memory available (I faced this problem and the symptomps were the same that you describe). At this point you have two options:

a) Increase memory (Virtual Machines or Docker) : Your container or VM needs more available memory. Follow this guide:

b) Generate swap file (Linux) : Try creating a swap file to provide more memory: (Above commands are from

free -m
mkdir -p /var/_swap_
cd /var/_swap_
#Here, 1M * 2000 ~= 2GB of swap memory
dd if=/dev/zero of=swapfile bs=1M count=2000
mkswap swapfile
swapon swapfile
chmod 600 swapfile
echo "/var/_swap_/swapfile none swap sw 0 0" >> /etc/fstab
#cat /proc/meminfo
free -m

Solution 4 - Json

Some times it is stuck because it is trying to use HTTP instead of https so just run this

composer config --global repo.packagist composer

Solution 5 - Json

Working for me. First Run command for auto load, then clear cache and run update.

composer dump-autoload
php artisan cache:clear
php artisan view:clear
composer update

Solution 6 - Json

For me the issue was with xDebug. I was using IDE's terminal, and the debugger was listening to incoming connections (as always). Turning the listening off (without requiring to disable the extension) solved the issue.

Solution 7 - Json

this worked for me:

composer self-update

Solution 8 - Json

I solved it by running command NOT IN VS CODE TERMINAL

Solution 9 - Json

Restart your system.

I faced the same problem today. Going by advice, turned off xdebug, but did not help. Verified all files were present. Restarted my system, and it worked.

Solution 10 - Json

Check if you are running the minimum required php version

Compare with the specified required php version in the composer.json file

Open terminal run

php -v

Cross check in composer.json file see example below

"require": { "php": "^7.1.3", }

Solution 11 - Json

check the path of [xdebug] zend_extension = "file/path" in php.ini

Solution 12 - Json

I found this in another article, I found that doing the following below worked. It seemed to be a cache/download issue into the composer packages cache.

composer update -vvv

Then doing the following: Add or edit your composer file to have these settings.

"repositories": [
         "type": "composer", 
         "url": ""
    { "packagist": false }

Solution 13 - Json

I solved it by editing php.ini file in order to set de cacert required for ssl verification:

  1. Download the file
  2. Edit php.ini to set the pat:

[openssl] ; The location of a Certificate Authority (CA) file on the local filesystem ; to use when verifying the identity of SSL/TLS peers. Most users should ; not specify a value for this directive as PHP will attempt to use the ; OS-managed cert stores in its absence. If specified, this value may still ; be overridden on a per-stream basis via the "cafile" SSL stream context ; option. openssl.cafile=C:\web\certs\cacert.pem curl.cainfo=C:\web\certs\cacert.pem ```

  1. Try again

Solution 14 - Json

Personally, I discovered using free that my system had 0kb of swap storage. Creating a 1GB swap file using solved the problem instantly.


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionChrisView Question on Stackoverflow
Solution 1 - JsonOnshopView Answer on Stackoverflow
Solution 2 - JsonChrisView Answer on Stackoverflow
Solution 3 - JsonmanuelbcdView Answer on Stackoverflow
Solution 4 - JsonDaniel RaoufView Answer on Stackoverflow
Solution 5 - JsonArshad JilaniView Answer on Stackoverflow
Solution 6 - JsonMostafa TalebiView Answer on Stackoverflow
Solution 7 - JsonGO.exeView Answer on Stackoverflow
Solution 8 - JsonEugeneGpilView Answer on Stackoverflow
Solution 9 - JsonAbhinavView Answer on Stackoverflow
Solution 10 - JsonGpakView Answer on Stackoverflow
Solution 11 - JsonRJHView Answer on Stackoverflow
Solution 12 - JsonJamie RossView Answer on Stackoverflow
Solution 13 - JsonmanixView Answer on Stackoverflow
Solution 14 - JsonGeorgeView Answer on Stackoverflow