Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Executing Multiple Times

Tags:

php

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?

like image 406
MrSimonEmms Avatar asked Feb 19 '23 20:02

MrSimonEmms


1 Answers

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;
like image 120
Tim Fountain Avatar answered Feb 22 '23 11:02

Tim Fountain