logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache does not respond anymore after file_get_contents
Author
haakon_hassel



Joined: 22 Sep 2012
Posts: 5
Location: Norway, Bergen

PostPosted: Sun 23 Sep '12 9:27    Post subject: Apache does not respond anymore after file_get_contents Reply with quote

I have been using your Apache-binaries for Windows for a year and a half now. The reason for registering at the forum now, is that I am experiencing
problems with Apache 2.4 after an upgrade/clean install.

To sum it up, every time I use the command "file_get_contents" in conjunction with PHP to fetch a file in my own network, the webserver crash/does not respond, before I restart it. I have tried every trick on the Internet, and of corse the allow_url_fopen is set to on.

This message comes up in my Apache error-log
Code:
PHP Warning:  file_get_contents(http://update.info-tv.org/current_version.cfg): failed to open stream: HTTP request failed!  in E:\\wwwroot\\info-tv.org\\info-tv_test\\admin\\update_check.php on line 35


I have tried different servers as well. First at my home-server with NAT-translation, later with an virtual private server at a datacenter nearby. There the public, external IP-address is mapped directly to the servers NIC. The OS is Windows Server 2008 R2, and Windows Server 2012 RTM. I have installed VC9 and VC10. Installed Apache using the command httpd.exe -k install, PHP-module and handler added to httpd.conf.

I downgraded to Apache 2.2 again, and the problem is solved. I does not think the fault is with PHP, as I now use the same PHP-version, and the same php.ini as with Apache 2.4. (PHP 5.4.7)

Another problem I just discovered is that if I am accessing my subdomain update.info-tv.org, wich in turn redirects the user to a .zip-file in my root domain info-tv.org, the webserver also crash. After just visiting the update-subdomain, my webserver becomes unavailable for many minutes. I am using an ordinary <meta http-equiv.. redirect tag

The vhosts-file look like this
Code:
<VirtualHost *:80>
    ServerAdmin support@hasseltech.no
    DocumentRoot "e:/wwwroot"
    ErrorLog "logs/error.log"
    CustomLog "logs/access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin support@hasseltech.no
    DocumentRoot "e:/wwwroot/hasseltech.no"
    ServerName hasseltech.no
    ServerAlias www.hasseltech.no
    ErrorLog "logs/hasseltech.no-error.log"
    CustomLog "logs/hasseltech.no-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin support@info-tv.org
    DocumentRoot "e:/wwwroot/info-tv.org"
    ServerName info-tv.org
    ServerAlias www.info-tv.org
    ServerAlias adn.info-tv.org
    ServerAlias activation.info-tv.org
    ErrorLog "logs/info-tv.org-error.log"
    CustomLog "logs/info-tv.org-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin support@info-tv.org
    DocumentRoot "e:/wwwroot/info-tv.org/update"
    ServerName update.info-tv.org
    ErrorLog "logs/info-tv.org-error.log"
    CustomLog "logs/info-tv.org-access.log" common
</VirtualHost>


I hope you, or other people at the forum will be able to help me solve this issue.

Thank you for your time Wink
Back to top
haakon_hassel



Joined: 22 Sep 2012
Posts: 5
Location: Norway, Bergen

PostPosted: Sun 23 Sep '12 17:15    Post subject: Works with XAMPP Reply with quote

It does work with XAMPP Beta, which use Apache 2.4. Is there maybe some configuration changes I need to apply to the Apachelounge Apache 2.4?

I am really confused.

Please help me if you can Wink

-Håkon
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3092
Location: Hilversum, NL, EU

PostPosted: Sun 23 Sep '12 17:38    Post subject: Reply with quote

You are using 2.4.3 ?
If no, upgrade to it and add to your httpd.conf :

AcceptFilter https none
AcceptFilter http none
EnableSendfile Off
EnableMMAP off

XAMPP is using our httpd builds, see http://www.apachelounge.com/viewtopic.php?t=4901
Back to top
haakon_hassel



Joined: 22 Sep 2012
Posts: 5
Location: Norway, Bergen

PostPosted: Sun 23 Sep '12 18:18    Post subject: Thank you! Reply with quote

Thank you Steffen, that solved the problem.
Now I can use my "check for updates"-script again Smile

But do you know what can have caused it? Because the problem only occured if I tried to access files from within my network, and when accessing files from the same server that Apache run from.

Anyway you solved the issue, thank you again.


Best regards from
Håkon Hassel
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3092
Location: Hilversum, NL, EU

PostPosted: Sun 23 Sep '12 20:25    Post subject: Reply with quote

Good to hear that it is solved.

Maybe XAMPP has that setting already in the httpd.conf. I do not change any setting in Apache delivered by the ASF. Next time I shall put a note in the Readme in the .zip's.

Steffen
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Mon 24 Sep '12 3:47    Post subject: Reply with quote

EnableMMAP off

I'm not so sure this is a good all around thing, I have noticed much better performance leaving it on (default) and just turn it off in directories holding large files for download. It's not a global only setting and can be used in the virtual host, directory and .htaccess contexts as well. If you have enough RAM for the amount of traffic, leaving it on should speed things up some?

EnableSendfile's default is Off per docs so adding it is not changing anything. I'm using just the AcceptFilters and hum along just fine.

Just my two eurocents
Back to top
haakon_hassel



Joined: 22 Sep 2012
Posts: 5
Location: Norway, Bergen

PostPosted: Tue 25 Sep '12 18:04    Post subject: Reply with quote

Hi glsmith

I tried to use only AcceptFilter http none, and it worked. You are probably right, there is no reason to disable other features of Apache if they does not cause any problems.

Currently I am running with AcceptFilter http connect, as "none" would be used for network adapters with broken driver support. (http://httpd.apache.org/docs/trunk/mod/core.html)

Thank you all for helping me out.

-Håkon
Back to top
ankhanh



Joined: 26 Sep 2012
Posts: 1
Location: Hanoi

PostPosted: Wed 26 Sep '12 18:11    Post subject: Re: Apache does not respond anymore after file_get_contents Reply with quote

I also had the same problem with Apache 2.4 after an upgrade! It got errors and I did not know how to fix it.
This topic is really useful. I can learn some good knowledge. Thanks!
Back to top
haakon_hassel



Joined: 22 Sep 2012
Posts: 5
Location: Norway, Bergen

PostPosted: Wed 26 Sep '12 18:22    Post subject: Re: Apache does not respond anymore after file_get_contents Reply with quote

ankhanh wrote:
I also had the same problem with Apache 2.4 after an upgrade! It got errors and I did not know how to fix it.
This topic is really useful. I can learn some good knowledge. Thanks!


You are welcome, glad to hear that it worked for you too.
Back to top


Reply to topic   Topic: Apache does not respond anymore after file_get_contents View previous topic :: View next topic
Post new topic   Forum Index -> Apache