Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

DDSameera's avatar

Failed to connect to repo.packagist.org port 443: Connection timed out), package information was loaded from the local cache and may be out of date

When i run this code in development server. then it shows me the message

Loading composer repositories with package information
https://repo.packagist.org could not be fully loaded (curl error 28 while downloading https://repo.packagist.org/packages.json: Failed to connect to repo.packagist.org port 443: Connection timed out), package information was loaded from the local cache and may be out of date

0 likes
6 replies
Snapey's avatar

why did you need to do this?

composer config -g repo.packagist composer https://packagist.org

I never....

4 likes
DDSameera's avatar

I run composer diagnose in my server . here is the result

[root@lexionmetal public_html]# composer diagnose

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist:
FAIL
The following exception probably indicates you are offline or have misconfigured DNS resolver(s)
[Composer\Downloader\TransportException] curl error 28 while downloading http://repo.packagist.org/packages.json: Resolving timed out after 10000 milliseconds
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.0.11
PHP version: 8.0.0
PHP binary path: /opt/cpanel/ea-php80/root/usr/bin/php
OpenSSL version: OpenSSL 1.1.1h  22 Sep 2020
cURL version: 7.72.0 libz 1.2.7 ssl OpenSSL/1.1.1g
zip: extension present, unzip present

ecxod's avatar

@DDSameera please check if you have "mod_security" or "mod_security2" enabled in your apache2 If you have access to the settings they are usually in /etc/modsecurity you can go like this :

mcedit /etc/modsecurity/crs/packagist.conf

SecRule SERVER_NAME "composer.org" \
    "id:1000,phase:1,t:none,nolog,allow,ctl:ruleEngine=Off"

SecRule SERVER_NAME "packagist.org" \
    "id:1001,phase:1,t:none,nolog,allow,ctl:ruleEngine=Off"

SecRule REMOTE_ADDR "@ipMatch 185.85.2.0/22" \
    "id:1002,phase:1,t:none,nolog,allow,ctl:ruleEngine=Off"

SecRule REMOTE_ADDR "@ipMatch 146.59.12.128/25" \
    "id:1003,phase:1,t:none,nolog,allow,ctl:ruleEngine=Off"

then

service apache2 restart

and have fun

1 like
Banyar Thaw's avatar

In my case, I just changed internet.I use phone wifi internet.I have two SIM cards for phone wifi and when I use internet of primary sim card phone wifi that error showed.So I switched to the internet wifi of Second phone SIM card and the problem solved for me.

Please or to participate in this conversation.