Displaying the apache error log on the webpage?

Discussion in 'NZ Computing' started by Waylon Kenning, Oct 23, 2004.

  1. Hi guys,

    I'm working with Apache2.0.52 and PHP Version 5.0.2. My PHP errors are
    being placed into error.log in the logs folder of apache which is
    cool, but how do I get the error to display in the html code being
    spat out of this development server? I dug around httpd.conf, but I
    couldn't see anything. Obviously it's a lot easier seeing errors on
    screen than hidden in error.log. Thanks for the help guys:)
     
    Waylon Kenning, Oct 23, 2004
    #1
    1. Advertisements

  2. Waylon Kenning

    Gurble Guest

    Hi, Waylon.

    Do a search for php.ini. If you are using Windows, this is normally in
    c:\windows. I can't remember off the top of my head where it is placed
    in Linux.

    This file has pretty clear instructions in the Error Reporting and
    Logging section - eg the variables: error_reporting and
    display_errors.

    Post again if you need more info.
     
    Gurble, Oct 23, 2004
    #2
    1. Advertisements

  3. It seems like Sat, 23 Oct 2004 16:30:21 +1300 was when Gurble
    Hey Gurble,

    Thanks for the reply. I've got error reporting to E_ALL, and
    display_errors on, and the php errors do dump to
    /Apache2/logs/error.log, which looks like
    So I'm assuming the PHP part of things are going well, I just can't
    figure out how to tell Apache to display this error on the screen
    instead of just writing it to error.log. Any further suggestions?
     
    Waylon Kenning, Oct 23, 2004
    #3
  4. Waylon Kenning

    Gurble Guest

    Hi, Waylon.

    The problem is definately with the PHP config rather than the Apache
    config. Apache just displays what PHP tells it to - it does not
    differentiate between errors and other statements.

    In php.ini, look for log_errors, and change it to:

    log_errors = Off

    Also, you want to comment out the error_log line (ie put a semicolon
    at the start of the line) if not done already.

    Let us know how you get on.

    Oh, and did you restart Apache after making the changes?
     
    Gurble, Oct 23, 2004
    #4
  5. Waylon Kenning

    Enkidu Guest

    As far as I know, and I do know quite a bit about apache, there is no
    way to display the log as a web page.

    It may be that php errors can be displayed in a web page, I don't
    know. If you can trap the error in the php program you could write a
    special error page, with the error displayed in the page, or maybe as
    an HTML comment in that page.

    Cheers.

    Cliff
     
    Enkidu, Oct 23, 2004
    #5
  6. Waylon Kenning

    Gurble Guest

    Apache cannot, however PHP can, and often does by default (esp in a
    developmental environment).

    eg:
    http://www.auto-moto.com/autoweb/
    http://webs.sir-ranulf.net/donofrio/guestbook/

    Obviously, error reporting should be turned off on a production
    server.

    (There are thousands of other examples - check Google)
     
    Gurble, Oct 23, 2004
    #6
  7. It seems like Sat, 23 Oct 2004 17:26:37 +1300 was when Gurble
    <> said Blah blah blah...

    Aha, thanks for your comment! Turns out I had two copies of php.ini,
    one in c:\windows that I'd been editing, and one in the php directory
    that php was looking at. After deleting php.ini in the php directory,
    all is now well.

    Thanks Gurble for helping me:)
     
    Waylon Kenning, Oct 23, 2004
    #7
  8. Waylon Kenning

    Gurble Guest

    No problems. Glad you got it sorted! :)
     
    Gurble, Oct 23, 2004
    #8
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.