Joe_Dean Posted September 18, 2008 Share Posted September 18, 2008 Hi, I have this socket script implemented into my SMF forums that connects to a gaming server and outputs info about the server (current players, max allowed players, etc). The gaming server does go offline quite a bit, and when this happens, my forums don't load. So the forums only load if the server is online, and I don't want the forums depending on the server to operate, yet I really want this script on my forums to show information about the gaming server. I'm not a PHP programmer, this is someone else's script, and I've even tried contacting them for support but they posted this script like a year ago and there is no way of contacting for support. Here's the script: http://pastebin.com/f71cf4473 Can someone make the script halt itself if it cannot connect to the gaming server within so many seconds? Link to comment https://forums.phpfreaks.com/topic/124832-need-some-help-with-socket-script/ Share on other sites More sharing options...
DyslexicDog Posted September 18, 2008 Share Posted September 18, 2008 If the server is down it should error out here. Can you take your server down for testing? You might want to try turning on your PHP error messages at the server and then take down your gaming server to get better information on why your script dies. echo "Socket Error: $errno - $errstr"; Link to comment https://forums.phpfreaks.com/topic/124832-need-some-help-with-socket-script/#findComment-644879 Share on other sites More sharing options...
Joe_Dean Posted September 18, 2008 Author Share Posted September 18, 2008 What is being tested here? It's simple - when the gaming server is online, my forums load. If not, they don't load. Taking my server offline tests what exactly? Link to comment https://forums.phpfreaks.com/topic/124832-need-some-help-with-socket-script/#findComment-644881 Share on other sites More sharing options...
DyslexicDog Posted September 18, 2008 Share Posted September 18, 2008 But determining where your script fails and stops the forum from loading is necessary to fix the code. Most web hosts turn off PHP error reporting so they don't blast sensitive information to the random web folks. When error reporting is turned off and PHP fails during the script, you get ZERO information from the web server. No HTML, no JAVASCRIPT, just nothing. if you turn on error reporting and close your gaming server down you'll get error messages on the website that will allow for an easier correction of your problem. Link to comment https://forums.phpfreaks.com/topic/124832-need-some-help-with-socket-script/#findComment-644884 Share on other sites More sharing options...
Joe_Dean Posted September 18, 2008 Author Share Posted September 18, 2008 I see, so how do I enable error reporting? Link to comment https://forums.phpfreaks.com/topic/124832-need-some-help-with-socket-script/#findComment-644902 Share on other sites More sharing options...
DyslexicDog Posted September 18, 2008 Share Posted September 18, 2008 It depends on the server setup, you could contact your host they may need to enable it, or you can turn on error reporting using your forums, or you can place a .htaccess file in the correct directory. Once you have error reporting turned on you should be able to get an error message that I can help you with even further. Link to comment https://forums.phpfreaks.com/topic/124832-need-some-help-with-socket-script/#findComment-644911 Share on other sites More sharing options...
Joe_Dean Posted September 19, 2008 Author Share Posted September 19, 2008 I have found out from my host that error reporting is enabled. So what now? :/ Link to comment https://forums.phpfreaks.com/topic/124832-need-some-help-with-socket-script/#findComment-645346 Share on other sites More sharing options...
DyslexicDog Posted September 19, 2008 Share Posted September 19, 2008 Check your email, I will post the fix when we get this sorted out. Link to comment https://forums.phpfreaks.com/topic/124832-need-some-help-with-socket-script/#findComment-645352 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.