Max Posted January 28, 2017 Share Posted January 28, 2017 Here's a general question... I suspect most of us have done it at some time - I certainly have - uploading a program by mistake to a server, that has an infinite loop in it (usually 'while(){....}') which means that the program whizzes round a million times sending hundreds of error messages to your e-mail address. QUESTION: Eventually the server will kill the program automatically, but is there any way (in php or otherwise server-side) to kill it? I suppose one could add a line in the loop such as $x+; if (x$>'1000'){die()} to save this embarrassment! "To err is human, but it takes a computer to REALLY $&** things up!!" Link to comment Share on other sites More sharing options...
Larry Posted January 28, 2017 Share Posted January 28, 2017 Good question! If it helps, while this does/can happen, it tends to happen less and less the more you program. But in answer to your question, closing the browser window/tab should suffice. Link to comment Share on other sites More sharing options...
Max Posted January 30, 2017 Author Share Posted January 30, 2017 Hi Larry Thanks for that, but the php seems to be running in the server - I still get hundreds of e-mails per minute with the same error (the error is just a notice, not related to the problem. Eventually the server blocks the website for a day and just gives a 'Website not available' message. I guess they're waiting for the server to cool down after whizzing round in circles . The worst of it is that I feel so bally FOOLISH!! Link to comment Share on other sites More sharing options...
abigail Posted January 30, 2017 Share Posted January 30, 2017 Your server provider should be able to help you with this, I would think. Link to comment Share on other sites More sharing options...
Max Posted January 30, 2017 Author Share Posted January 30, 2017 Hi Abigail Thanks for that. My provider doesn't offer e-mail help - you have to phone them and I was hoping to avoid the embarrassment of admitting that I'd done something stoopid !! The web site will be back tomorrow (did before when I screwed up). I would be nice to be able to kill it through php some way. I have tried most things - logging out, uploading (FTP) a safe version of the program. Regards Max Link to comment Share on other sites More sharing options...
Larry Posted January 31, 2017 Share Posted January 31, 2017 It does happen to the best of us! Given that your script is outputting emails, the trick is you don't know whether the script is continuing to run or you're just continuing to receive a backlog of emails from the one run. It's probably the latter. Fixing the script is the first thing you need to do (if you haven't). Then restart Apache to stop all requests from being processed. Then restart your mail server and/or clear its queue, if you can, although I wouldn't know where to begin to start with that myself. Link to comment Share on other sites More sharing options...
Recommended Posts