Issue
This post is linked with another post of mine (still unsolved):
href="https://stackoverflow.com/questions/52404280/laravel-composer-update-connection-refused">Laravel - composer update: Connection refused
But I'm making another post about a more specific question.
On SSH, on prod server (shared hosting), I go to a specific folder (which contains my website):
$ cd /home/user/www/prod/
Then, if I try:
$ curl https://larapack.io/packages.json
I get:
curl: (7) Failed to connect to larapack.io port 443: Connection refused
But if I do:
$ curl https://packagist.org/packages.json
It works.
Note that both files are accessible through my browser.
I've read several things on forums about IPv6 or firewalls, but:
I don't know if it could cause thatI can't find a proper way to check if both are disabled or not.
EDIT: Trying other things...
It seems it's not a user agent/referer issue: (try with chrome 65 on windows 10)
$ curl -A "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3315.4Safari/537.36" https://larapack.io/packages.json
curl: (7) Failed to connect to larapack.io port 443: Connection refused
It seems it's not a IPV6 issue: (option -4
to force IPv4)
$ curl -4 https://larapack.io/packages.json
curl: (7) Failed to connect to larapack.io port 443: Connection refused
It seems it's not a ssl issue: (option -k
to skip the ssl things)
$ curl -k https://larapack.io/packages.json
curl: (7) Failed to connect to larapack.io port 443: Connection refused
It seems it's not a firewall issue: I have a config file with valid directive firewall=none
It doesn't work with wget
:
$ wget https://larapack.io/packages.json
pathconf: Value too large for defined data type
pathconf: Value too large for defined data type--2018-09-23 13:47:26-- https://larapack.io/packages.json
Resolving larapack.io (larapack.io)... 23.92.17.233
Connecting to larapack.io (larapack.io)|23.92.17.233|:443...
failed: Connection refused.
And neither with nc
command (I don't have telnet command, but it works almost the same, as I could read)
$ nc larapack.io 443
larapack.io [23.92.17.233] 443 (https) : Connection refused
I tried to curl with php, and it works! So it seems it's only with SSH:
<?php
$url = "https://larapack.io/packages.json";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url
));
$resp = curl_exec($curl);
curl_close($curl);
echo $resp;
Solution
For french developers using SSH with a shared hosting pro at OVH, the support says external calls like curl
are disabled in ssh, but obviously I can do curl https://packagist.org/packages.json
.
When they tried themselves, they got an error like action forbidden
or something like that.
It doesn't make any sense.
I solved my prior issue doing composer install
instead of composer update
.
Here is the first discussion for reference: Laravel - composer update: Connection refused
Answered By - charlie Answer Checked By - Marilyn (WPSolving Volunteer)