4

I've got a standard LAMP setup on my machine. This morning, it started executing scripts multiple times.

For instance, in the code:

log_message('error', "here be a message ".rand()); exit;

My log file is recording TWO log messages with a different random number, despite there being an exit in the script. I've not had this before and a little bit stumped. Can anyone give me any clues as to why this might be happening?

3
  • Is this script included? Any chance it's being included/required multiple times? Commented Jul 17, 2012 at 11:26
  • 2
    Do you get two entries in the Apache access log? Commented Jul 17, 2012 at 11:27
  • This was an odd one. For some reason, two instances of Apache were running. Once I rebooted the machine, it started working correctly (ie, one instance). No idea why or how two instances on the same port (80) were running, but rebooting the machine fixed it. Commented Oct 10, 2012 at 8:59

1 Answer 1

8

If you're rewriting URLs a common issue can be the browser requesting /favicon.ico, which causes a second request. The simplest way to check this is to temporarily add the REQUEST_URI to your log line:

log_message('error', "{$_SERVER['REQUEST_URI']} - here be a message ".rand());
exit;
Sign up to request clarification or add additional context in comments.

1 Comment

I'd even checked that too. It appears that it was FireFox that was causing an issue. No idea what/what, but restarting it cured the problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.