开发者

Can't Run PHP cURL in IIS Web App, But Can From CLI

I'm running 5.2.14 with IIS on Windows 7. Used the Windows Platform Installer.

When I write a script that uses cURL or file_get_contents() and run it via the commandline, everything works great.

If I use the same code in a web page, running in IIS, the request always fails. cURL returns a response code of 0. file-get_contents comes back with "Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No such host is known". I even tried putting the code in a separate script and running it via exec() to pipe the output back to my web script. But the script, which works fine from the CLI, fails when called by a PHP script being executed by IIS.

php.exe -i returns no errors. phpinfo() run via IIS in a web page shows the same active/activated cURL as in php.exe -i. My libeay.dll and ssleay.dll libraries are all over my path.

There doesn't seem to be a problem with cURL itself. My best guess is that this is a firewall thing or a permissions thing, where IIS runs PHP as a 开发者_C百科guest user who is blocked from network access, but when I run it from the commandline, I'm not blocked.

I don't know enough about configuring IIS or the firewall or security policies to figure out where to change things and I don't want to accidentally open up a big hacker tunnel into my system by just randomly lowering security until something clicks. Please help.


"Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No such host is known".

That's your clue, No such host is known, try a raw IP address see if that works, if so then it's because PHP can't see hosts basically IIS isn't passing that info in perhaps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜