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:)
    --
    Regards,
    Waylon Kenning.

    1st Year B.I.T. WelTec
     
    Waylon Kenning, Oct 23, 2004
    #1
    1. Advertising

  2. Waylon Kenning

    Gurble Guest

    On Sat, 23 Oct 2004 15:46:17 +1300, Waylon Kenning
    <> had this to say:

    >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:)


    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. Advertising

  3. It seems like Sat, 23 Oct 2004 16:30:21 +1300 was when Gurble
    <> said Blah blah blah...

    >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.


    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
    >[client 127.0.0.1] PHP Parse error: syntax error, unexpected '{' in
    >G:\\Program Files\\Apache Group\\Apache2\\htdocs\\php\\hello.php on
    >line 4, referer: http://localhost/php/

    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?
    --
    Regards,
    Waylon Kenning.

    1st Year B.I.T. WelTec
     
    Waylon Kenning, Oct 23, 2004
    #3
  4. Waylon Kenning

    Gurble Guest

    On Sat, 23 Oct 2004 16:59:36 +1300, Waylon Kenning
    <> had this to say:

    >It seems like Sat, 23 Oct 2004 16:30:21 +1300 was when Gurble
    ><> said Blah blah blah...
    >
    >>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.

    >
    >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
    >>[client 127.0.0.1] PHP Parse error: syntax error, unexpected '{' in
    >>G:\\Program Files\\Apache Group\\Apache2\\htdocs\\php\\hello.php on
    >>line 4, referer: http://localhost/php/

    >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?


    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

    On Sat, 23 Oct 2004 16:59:36 +1300, Waylon Kenning
    <> wrote:
    >
    >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
    >>[client 127.0.0.1] PHP Parse error: syntax error, unexpected '{' in
    >>G:\\Program Files\\Apache Group\\Apache2\\htdocs\\php\\hello.php on
    >>line 4, referer: http://localhost/php/

    >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?
    >

    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

    On Sat, 23 Oct 2004 18:05:10 +1300, Enkidu <> had
    this to say:

    >On Sat, 23 Oct 2004 16:59:36 +1300, Waylon Kenning
    ><> wrote:
    >>
    >>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
    >>>[client 127.0.0.1] PHP Parse error: syntax error, unexpected '{' in
    >>>G:\\Program Files\\Apache Group\\Apache2\\htdocs\\php\\hello.php on
    >>>line 4, referer: http://localhost/php/

    >>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?
    >>

    >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.


    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...

    <snip>
    >Oh, and did you restart Apache after making the changes?


    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:)
    --
    Regards,
    Waylon Kenning.

    1st Year B.I.T. WelTec
     
    Waylon Kenning, Oct 23, 2004
    #7
  8. Waylon Kenning

    Gurble Guest

    On Sun, 24 Oct 2004 00:30:44 +1300, Waylon Kenning
    <> had this to say:

    >It seems like Sat, 23 Oct 2004 17:26:37 +1300 was when Gurble
    ><> said Blah blah blah...
    >
    ><snip>
    >>Oh, and did you restart Apache after making the changes?

    >
    >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:)


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

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Silverstrand

    Beginners Guides: Website Hosting With Apache

    Silverstrand, Oct 24, 2005, in forum: Front Page News
    Replies:
    0
    Views:
    801
    Silverstrand
    Oct 24, 2005
  2. tejlor
    Replies:
    0
    Views:
    1,346
    tejlor
    Jan 16, 2004
  3. raghav
    Replies:
    1
    Views:
    518
    Dave Lear
    Oct 23, 2005
  4. William Warren

    Unknown entry in Apache log

    William Warren, Aug 25, 2003, in forum: Computer Security
    Replies:
    0
    Views:
    396
    William Warren
    Aug 25, 2003
  5. ijuba

    Printer showing on network but displaying error

    ijuba, Mar 23, 2007, in forum: Wireless Networking
    Replies:
    1
    Views:
    408
    Jack \(MVP-Networking\).
    Mar 24, 2007
Loading...

Share This Page