Best practices for creating an exception log file in PHP on a public website
<p>I am currently running on a homegrown PHP framework that outputs a nicely formatted HTML document with lots of great information when an exception is encountered and it is running in debug mode.  </p>

<p>When it is running in production on the public site, debug mode is off and it simply returns a proper message to the user.  Everything works just as it should. Except for the fact that it doesn't log errors in the production environment.  I'd like for it to take the HTML documents that it creates in my development environment and, instead of displaying to the user (obviously), store them somewhere.  </p>

<p>The issue I'm running into is that PHP cannot create a file above the root nor can it create a file within the root in a folder that is anything but wide-open.  Due to the very explicit nature of my error reporting, I need to store this information in a secure environment and in a public folder in the public root doesn't seem like the best place.  </p>

<p>I realize the other options are to put this info in a database but if the error is a database connection issue, that's no good.  And it can be emailed but again, if there is a connection issue to the SMTP server, that's no good.  Plus, I don't want to spam myself if something goes really haywire.  </p>

<p>So, what is the best practice here?  I'm certain I'm just missing something obvious.  Thank you.</p>

<p>BTW, I'm running PHP v5.2 on Apache, hosted on a shared server.</p>
