PSD to HTML conversion PSD to HTML conversion PSD2HTML.com with over 300 professionals takes the designs to HTML and beyond

Code Snippet

Home » Code Snippets » HTAccess » PHP Error Logging

PHP Error Logging

Log errors to a file, and prevent showing them to the user. Make sure that the file exists and youre able to write to it.

# display no errs to user
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
# log to file
php_flag log_errors on
php_value error_log /location/to/php_error.log

Subscribe to The Thread

  1. sofiane says:

    this is really interesting thank you

  2. Tice says:

    Where does this code go? .htaccess, a php file?

  3. holodoc says:

    Too bad it won’t work on a lot of web servers because of the restrictive AllowOverride setting :(

  4. emprear says:

    You can’t set flags in .htaccess if PHP is installed as CGI, only if is installed as Apache Module. Check before with phpinfo();

    Bye

  5. kuldeep says:

    This will remove it from my original var log, cant we log at both place?
    Thanks

  6. Avi says:

    Nice One…….

  7. ersnews says:

    Just try it for my wp blog and it’s working. This easier mylife to find some errors. Awesome.

  8. kapil says:

    hello nice work

Speak, my friend

At this moment, you have an awesome opportunity* to be the person your mother always wanted you to be: kind, helpful, and smart. Do that, and we'll give you a big ol' gold star for the day (literally).

Posting tips:
  • You can use basic HTML
  • When posting code, please turn all
    < characters into &lt;
  • If the code is multi-line, use
    <pre><code></code></pre>
Thank you,
~ The Management ~