1

I'm getting a bunch of errors on Production environment that I can't reproduce locally. Therefore I'm looking to find out which URL the user is requesting. This URL is currently not being outputted to the error log, so I'm just wondering how I would go by displaying that?

jaimeT
  • 133
  • 1
  • 15

1 Answers1

1

you can print to log file using trigger_error (http://php.net/trigger_error), ie:

trigger_error($_SERVER[REQUEST_URI]);

trigger_error by default generates user level notification, so it will not break anything.

if REQUEST_URI is not enough, please check Get the full URL in PHP.

Community
  • 1
  • 1
rsm
  • 2,530
  • 4
  • 26
  • 33
  • 1
    How does this answer the OP? He wants the Request_URL to be printed in the php error-log file when an error happens in his code. So he can trace where that error might come from. trigger_error only writes to the log. – MastaP Jun 09 '22 at 21:50