问题
I installed an SSL certificate on my Ubuntu 16.04 server and since then composer has stopped working correctly.
The certificate works correctly when accessing the website through a browser. However, when running sudo composer update
, I get the following warning:
The "https://packagist.org/packages.json" file could not be downloaded:
php_network_getaddresses: getaddrinfo
failed: Temporary failure in name resolution failed to open stream:php_network_getaddresses
:getaddrinfo
failed: Temporary failure in name resolution https://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
And then the following error:
Updating dependencies (including `require-dev`)
- Updating soundasleep/html2text (0.2.2 => 0.3.4)
Checking out a1f77b8f340c8425b746bef1d1040189e89be334
Update failed (Failed to clone https://github.com/soundasleep/html2text.git via https, ssh protocols, aborting.
>
- https://github.com/soundasleep/html2text.git
fatal: unable to access 'https://github.com/soundasleep/html2text.git/': Could not resolve host: github.com
>
- git@github.com:soundasleep/html2text.git
ssh: Could not resolve hostname github.com: Temporary failure in name resolution
fatal: Could not read from remote repository.
>
Please make sure you have the correct access rights
and the repository exists.
)
`Would you like to try reinstalling the package instead [yes]?`
If I try to reinstall it, it returns the following:
- Removing soundasleep/html2text (0.2.2)
- Installing soundasleep/html2text (0.3.4)
Cloning a1f77b8f340c8425b746bef1d1040189e89be334
Failed to download soundasleep/html2text from source: Failed to clone https://github.com/soundasleep/html2text.git via https, ssh protocols, aborting.
- https://github.com/soundasleep/html2text.git
Cloning into '/path/to/dir/vendor/soundasleep/html2text'...
fatal: unable to access 'https://github.com/soundasleep/html2text.git/': Could not resolve host: github.com
- git@github.com:soundasleep/html2text.git
Cloning into '/path/to/dir/vendor/soundasleep/html2text'...
ssh: Could not resolve hostname github.com: Temporary failure in name resolution
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Now trying to download from dist
- Installing soundasleep/html2text (0.3.4)
Downloading: 100%
Downloading: 100%
Downloading: 100%
[Composer\Downloader\TransportException]
The "https://api.github.com/repos/soundasleep/html2text/zipball/a1f77b8f340
c8425b746bef1d1040189e89be334" file could not be downloaded: php_network_ge
taddresses: getaddrinfo failed: Temporary failure in name resolution
failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
sudo composer diagnose
returns this:
Checking http connectivity to packagist: FAIL
[Composer\Downloader\TransportException] The "http://packagist.org/packages.json" file could not be downloaded: `php_network_getaddresses: getaddrinfo failed`: Temporary failure in name resolution
failed to open stream: `php_network_getaddresses: getaddrinfo` failed: Temporary failure in name resolution
Checking https connectivity to packagist: FAIL
I already tried export http_proxy=myexternalip:80
and export https_proxy=myexternalip:443
(as well as HTTP_PROXY
and HTTPS_PROXY
but with no luck.
来源:https://stackoverflow.com/questions/40091610/composer-update-not-working-since-installing-ssl-certificate