Composer stops with curl error 28 while downloading packages
curl error 28 while downloadingShort answer
Curl error 28 is a timeout. Composer either waited too long for a slow transfer, or never got a connection because the IPv6 route is broken. Raise the stall timeout for slow links, force IPv4 with COMPOSER_IPRESOLVE=4 for broken IPv6, and check any antivirus web scanner.
Fix it fast
1Find out which cause you have
Run Composer's own self-check. It tests the connection to Packagist and GitHub and tells you whether IPv6 or a proxy is involved.
composer diagnose2Match what you see, then jump to its fix
- 1
Less than 1 bytes/sec transferred the last 30 seconds, or Operation timed out after 300000 millisecondsThe transfer is slow and Composer gives upFix - 2
The timeout appears before any data arrives, on a network or server where IPv6 is advertised but does not work.A broken IPv6 route makes connections hangFix - 3
The same timeout keeps coming back, even though other machines on another network download fine.A security product scans the HTTP trafficFix
- 1
What does the error look like?
curl error 28 while downloadingOperation timed out after 300000 millisecondsOperation too slow. Less than 1 bytes/sec transferred the last 30 seconds
Cause 1 of 3
The transfer is slow and Composer gives up
1Check
The two messages mean different limits. The 30-second one is Composer's stall timeout (nothing arrived for 30 seconds). The 300000 ms one is PHP's socket timeout.
php -i | grep default_socket_timeout2Fix
Raise the stall timeout for this run (0 disables it), and raise default_socket_timeout in the php.ini that the command line uses.
COMPOSER_HTTP_STALL_TIMEOUT=120 composer install
; php.ini (CLI)
default_socket_timeout = 6003Verify
Run the install again and watch it finish without the timeout.
composer install -vvvConfirmed by getcomposer.org
Cause 2 of 3
A broken IPv6 route makes connections hang
1Check
Composer can force IPv4 for a single run when the curl extension is used. If that run succeeds, IPv6 was the problem.
COMPOSER_IPRESOLVE=4 composer diagnose2Fix
Fix the IPv6 setup if you can. Otherwise keep IPv4 forced for Composer, or on Linux prefer IPv4 addresses system-wide.
COMPOSER_IPRESOLVE=4 composer install
# Linux, system-wide preference for IPv4
sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"3Verify
Run Composer again without the variable if you changed gai.conf.
composer diagnoseConfirmed by getcomposer.org
Cause 3 of 3
A security product scans the HTTP traffic
1Check
Composer switches to a degraded network mode after it first detects a network problem. If timeouts keep repeating, something between you and Packagist may be interfering.
composer diagnose -vvv2Fix
If you run ESET, turn off the HTTP scanner under web access protection and try again. Otherwise test from another network to rule out the firewall.
# ESET: Web access protection > HTTP scanner > off, then rerun composer3Verify
Run the install again.
composer installConfirmed by getcomposer.org
How do I stop it coming back?
- Run composer diagnose before reporting a download problem; it shows the failing host.
- In CI, cache the Composer download directory so a slow mirror does not block every build.
- If IPv6 is advertised on a server but not routed, fix it at the network level rather than working around it per tool.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Apache returns 503 or 504 because PHP-FPM did not answer in time
Error dispatching request
Apache sent the request to PHP-FPM and gave up waiting.
3 causes, each with a fixBack end
AWS SDK for PHP cannot get credentials from the instance profile metadata server
Error retrieving credentials from the instance profile metadata server.
The SDK tries the EC2 instance metadata service when it has no valid credentials from anywhere earlier in its chain.
4 causes, each with a fixBack end
AWS SDK for PHP rejects requests: the signature is from the future
Signature not yet current: {date} is still later than {date}
AWS compares the timestamp in your signed request with its own clock.
2 causes, each with a fixBack end
CodeIgniter 4 cannot write its cache files
CodeIgniter\Cache\Exceptions\CacheException: Cache unable to write to /var/www/app/writable/cache/
CodeIgniter 4's file cache needs a cache directory that the web server can really write to.
2 causes, each with a fixBack end
CodeIgniter 3 loads the model but the property is undefined
The model name you are loading is the name of a resource that is already being used: user
CodeIgniter 3 expects a model file named like its class, with the first letter capitalised, for example User_model.php holding class User_model.
2 causes, each with a fixBack end
CodeIgniter 3 stops with "Your system folder path does not appear to be set correctly"
503 Service Unavailable
CodeIgniter 3's front controller resolves $system_path and then checks that the result is a directory.
3 causes, each with a fix