I am wishing there's a quirk about apache/php that I am missing.

The Code:

<?php
    $servers = array(
        array("70.89.xxx.226",25565,''),
        array("50.22.xxx.147",25591,''),
    );

    foreach($servers as $key=>$server){
        $fp = @fsockopen($server[0],$server[1],$errno,$errstr,.5);
        if(!$fp) {
            $servers[$key][2] = "DOWN";
        } else {
            $servers[$key][2] = "UP";
            @fclose($fp);
        }
        unset($fp);
    }


    echo"
    <table>
        <thead>
            <td>Minecraft Server Status</td>
        </thead>";

    foreach ($servers as $key=>$server){
        $keyplus = $key + 1;
        echo"
        <tr>
            <td>Server $keyplus: $server[0]:$server[1]</td>
            <td>$server[2]</td>
        </tr>";
    }

    echo "
    </table>";
    ?>

What it really does: check connectivity to a number of minecraft servers using the fsockopen function.

The issue: This code does precisely what it's designed to do on my local and my remote web servers. However, on my small remote server, the status always shows as Lower even if I understand they're UP, additionally they display as On my local server. I can not understand why my host wouldn't have the ability to achieve these servers, and so i hope its a server quirk i'm not sure about.

The best way to help: Maybe theres a different way to effectively ping an IP in php which i can use? or you are conscious of a server setting that's effecting my connectivity.

thank for reading through as well as your time ~TylerTofWA

Take away the @ on fsockopen to prevent controlling errors to ascertain if you will find errors being tossed in your remote server. Also make certain [cde] is placed to exhibit all errors using error_reporting.

Resolved.

I approached my webhost and also got the next:

Tyler!

Thank you for getting in touch with us.

Your script required about 10s to operate, but it did run:

[/root]# time php -q -f /tmp/nanno

error_reporting(A_ALL)

And not so good news, your servers are lower. However, this a part of your script is fine ) ... and that i get: Minecraft Server Status Server 1: 70.89.xxx.226:25565 Lower Server 2: 50.22.36.xxx:25591 Lower on

(therefore it appears like your browser or http connection is timing on your finish). Unless of course you realize of the method of modifying your script to reduce a timeout variable, your browser network timeout setting, or possibly should you run both fsocks concurrently you'd possess the run time?

Tell us for those who have any more questions or concerns.

Regards,

------ Robert C. Server Analyst II SurpassHosting.com, LLC http://www.surpasshosting.com http://www.surmunity.com


ME: Just prompt reply!

Well it required 10-seconds since there are two connection attempts with 5 second timeouts.

However , they shouldn't be timing out, I am within the server right now, and my local server can connect with fsockopen not a problem and can display them as UP.

Things I do not understand is the reason why my script can't 'see' my game servers from the web server.

Interesting time, TylerT


Them: Hello Tyler ,

The problem is bound you will see the status now .

Thanks

Regards, Praveen M Senior Unix Admin SurpassHosting.com, LLC http://www.surpasshosting.com http://www.surmunity.com

I dunno if they'll let me know exactly what the problem was, I'm very curious. LOL in the first response though.