+ Post New Thread
Results 1 to 7 of 7
Web Development Thread, display errors in Coding and Web Development; Major Grrrrrrrrrrrrrrrrrrrrrrrrr After much time banging my head again the wall over why I keep getting a blank page instead ...
  1. #1
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,497
    Thank Post
    101
    Thanked 84 Times in 71 Posts
    Blog Entries
    46
    Rep Power
    37

    display errors

    Major Grrrrrrrrrrrrrrrrrrrrrrrrr

    After much time banging my head again the wall over why I keep getting a blank page instead of output, I've discovered php now, by default, doesn't show code errors.

    ironically now i'm banging my head against the wall over how to get it to show code errors. Apparently just turning display_errors on in php.ini does nothing. :-S

    seriously, it really annoys me when what used to be a simple is now a major headache. Good thing ppl are going to the pub after work, I really need a drink!

  2. #2

    sonofsanta's Avatar
    Join Date
    Dec 2009
    Location
    Lincolnshire, UK
    Posts
    4,467
    Thank Post
    750
    Thanked 1,210 Times in 852 Posts
    Blog Entries
    45
    Rep Power
    533
    Let's be honest - when has a PHP error ever been any use beyond "something is wrong somewhere!" anyway?

    Generally being told there was an unexpected character on Line 856 means that I actually missed a semi-colon 200 lines before that

  3. #3

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    240
    Quote Originally Posted by sonofsanta View Post
    Let's be honest - when has a PHP error ever been any use beyond "something is wrong somewhere!" anyway?

    Generally being told there was an unexpected character on Line 856 means that I actually missed a semi-colon 200 lines before that
    I find PHP errors to be quite detailed. If it tells me there's a parse error on a certain line then it's now common sense to look the line before for a semi colon.

  4. #4
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,497
    Thank Post
    101
    Thanked 84 Times in 71 Posts
    Blog Entries
    46
    Rep Power
    37
    My code always has like 20million errors so they were pretty handy, and you do get used to what the more obscure ones tend to mean. I can't code when I don't know what my errors are.

  5. #5

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    240
    Quote Originally Posted by browolf View Post
    My code always has like 20million errors so they were pretty handy, and you do get used to what the more obscure ones tend to mean. I can't code when I don't know what my errors are.
    Have you set up a custom error handler? This is always the first step I take when coding anything with PHP.

  6. #6

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,216
    Thank Post
    2,768
    Thanked 935 Times in 875 Posts
    Rep Power
    343
    Quote Originally Posted by Hightower View Post
    Have you set up a custom error handler? This is always the first step I take when coding anything with PHP.
    how do you do that ?

    similiar to vbscript where you do something along the lines of
    Code:
    on error goto err:
    
    all your code goes here
    
    err:
    response.write error.description
    or something along those lines ??
    Last edited by mac_shinobi; 12th February 2010 at 03:29 PM.

  7. #7

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    240
    Create a function in your script:

    PHP Code:
    function custom_errors($errno$errstr){
    echo 
    "<p>$errno$errstr</p>";

    Then make sure you set it within your PHP script:

    PHP Code:
    set_error_handler(custom_errors); 
    This allows you to set your errors up to appear how you like. You can wrap it in CSS to make it look pretty etc...

    That's a very basic example. I set mine up to show if the site is not live, or show a simple error if site is live and email admin.

  8. Thanks to Hightower from:

    browolf (15th June 2010)

SHARE:
+ Post New Thread

Similar Threads

  1. KnowledgeBox Errors
    By mweller in forum Educational Software
    Replies: 1
    Last Post: 14th May 2010, 01:17 PM
  2. Many DC errors
    By AntiThesis in forum Windows Server 2000/2003
    Replies: 13
    Last Post: 19th January 2010, 11:53 AM
  3. HP Switch Errors
    By karldenton in forum Wireless Networks
    Replies: 4
    Last Post: 15th June 2009, 12:03 PM
  4. New 2003 R2 DC DS Errors
    By cookie_monster in forum Windows
    Replies: 3
    Last Post: 18th June 2008, 08:36 PM
  5. Replies: 0
    Last Post: 2nd July 2007, 03:27 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •