On Fri, May 07, 2010 at 11:23:12AM +0200, Alexander Farber wrote: > (...) I have to send a HTTP GET > request from one of my scripts to one host (to appsmail.ru). > > So I've added the file /var/www/etc/hosts: > > 127.0.0.1 localhost > 94.100.188.5 appsmail.ru www.appsmail.ru
Why did you hardcode the IP here, and then hardcode it below again? Let the resolver do its job. > And also have changed this line in /var/www/conf/php.ini: > > allow_url_fopen = On You could avoid setting this dangerous option by installing and using php5-curl. > Unfortunately I still get the error: > > Warning: file_get_contents(http://94.100.188.5/robots.txt) > [function.file-get-contents]: failed to open stream: No route to host > in /htdocs/mailru/index.php on line 18 > > This is because the default route (or at least the route to appsmail.ru) > is unknown to the chrooted Apache. (Script works ok at the console). Eh... the routing table is per-kernel, and does not need filesystem access. "No route to host" is most likely a wrong error message; please show the code. I don't *think* this is the reason, but note that http://94.100.188.5/robots.txt leads to a 404. I'm sorry I don't have a solution - just trying to fix some misunderstandings here. Joachim