Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2004
    Posts
    86

    Angry Strange file() issue - PHP

    So I am trying to resolve an issue with my companies server status script that we use to monitor a number of servers. It checks using cron and gets the load averages for each server by using the file() command to access a server side php file that reports the load avg. ANYWAY.. I'm getting this error when accessing ONLY ONE of the servers:

    Code:
    PHP Warning:  file(http://IPADDRESS:80/server_script.php): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
    Out of ~30 servers only one is causing this error. I've checked the firewall on the server causing the error and thats not the issue. I've flushed DNS on the checking server and the server causing the error. Even stranger, using

    Code:
    wget http://IPADDRESS:80/server_script.php
    through the shell works just fine. Has anyone experienced anything like this??
    Quick, SEO Friendly Backlinks: XEGS.com Web Directory

    Image Hosting

  2. #2
    Maybe there is a hidden character in your code for that URL? You can always try fopen, as that is meant to be used for URL's.

    http://us3.php.net/fopen

    If you are actually copying the file the copy() function might be easiest of all.

    http://us.php.net/copy

    $file = 'http://IPADDRESS:80/server_script.php';
    $newfile = '/local/path/to/server_script.php';

    if (!copy($file, $newfile)) {
    echo "failed to copy $file...\n";
    }
    "It's hard to dance if you just lost your wallet. Whoa! Where's my wallet? But, hey this song is funky." - Mitch Hedberg

  3. #3
    Join Date
    Feb 2003
    Location
    Canada
    Posts
    958
    Did you check the httpd logs on the server?

    Possible a mod_sec rule denying the request because of the User-Agent header?

  4. #4
    Join Date
    Nov 2004
    Posts
    86
    Issue is not resolved, thanks for the suggestions.

    Adam-AEC-
    It did turn out to be a misconfiguration in httpd.conf file (a mod_security rule).
    Quick, SEO Friendly Backlinks: XEGS.com Web Directory

    Image Hosting

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •