Answer the question
In order to leave comments, you need to log in
Why does curl work as root and not from php?
When you try to access the address in the browser, the page opens.
If I write https:// address in the curl console under root, then everything works,
but when I do it from php, it doesn’t work. Curl says Curl error: Couldn't resolve host " https://address ". Those. it cannot find the domain in DNS. If you explicitly add this address to /etc/hosts, the error disappears. What could be the problem, Apache has no rights? network settings?
Answer the question
In order to leave comments, you need to log in
Check that the console client speaks from under the Apache user.
HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
sudo -u $HTTPDUSER curl -vvv http://example.com
Oh my God
, did you install it for php at all?sudo apt-get install php5-curl
> Curl error: Couldn't resolve host " https://address ".
The request was formed incorrectly.
https is a scheme, but for some reason it got into your domain name.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question