SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Hybrid View

  1. #1
    SitePoint Guru phantom007's Avatar
    Join Date
    May 2008
    Posts
    752
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Question PHP Fatal Errors

    HI

    Why do not my php page display fatal errors?

    I am using the following code in all of my pages.

    Code:
    ini_set('display_errors',1);
    error_reporting(E_ALL);
    My page when receiving a fatal error displays a blank page instead of a fatal warning.

    Is there any other settings i need to do?

    I am using PHP 5 with Apache 2.2

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2008
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure if this is the right answer but if I recall correctly you use 'on' in:

    PHP Code:
    ini_set('display_errors''on'); 

  3. #3
    SitePoint Addict
    Join Date
    Apr 2009
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The only difference I can see in my config is that I use a double quoted string in my ini_set parameters, instead of your single quoted one.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jun 2008
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also unless you are root, your host has to allow for php.ini overrides.

  5. #5
    SitePoint Guru
    Join Date
    Jul 2005
    Location
    Orlando
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by markup2go View Post
    I'm not sure if this is the right answer but if I recall correctly you use 'on' in:

    PHP Code:
    ini_set('display_errors''on'); 
    You can use 1, or on. Or I'm sure there are other possibilities.

  6. #6
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    php first parses and then compiles the entire file before it begins executing even the first line. So if the file has a parse error in it, your attempts to turn up error reporting in that file won't ever be executed.

    You can turn up error reporting in a .htaccess file, or in php.ini. You can also do a temporary trick. Make a new file which has no parse errors, turn up error reporting, and then include the problem file.
    PHP Code:
    <?php
    ini_set
    ('display_errors',1);
    error_reporting(E_ALL);
    include 
    'the_problem_file.php';

  7. #7
    SitePoint Guru phantom007's Avatar
    Join Date
    May 2008
    Posts
    752
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by crmalibu View Post
    php first parses and then compiles the entire file before it begins executing even the first line. So if the file has a parse error in it, your attempts to turn up error reporting in that file won't ever be executed.

    You can turn up error reporting in a .htaccess file, or in php.ini. You can also do a temporary trick. Make a new file which has no parse errors, turn up error reporting, and then include the problem file.
    PHP Code:
    <?php
    ini_set
    ('display_errors',1);
    error_reporting(E_ALL);
    include 
    'the_problem_file.php';
    Isnt this whats my code was in the first post?

  8. #8
    SitePoint Guru phantom007's Avatar
    Join Date
    May 2008
    Posts
    752
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by crmalibu View Post
    php first parses and then compiles the entire file before it begins executing even the first line. So if the file has a parse error in it, your attempts to turn up error reporting in that file won't ever be executed.

    You can turn up error reporting in a .htaccess file, or in php.ini. You can also do a temporary trick. Make a new file which has no parse errors, turn up error reporting, and then include the problem file.
    PHP Code:
    <?php
    ini_set
    ('display_errors',1);
    error_reporting(E_ALL);
    include 
    'the_problem_file.php';

    That helped. BTW, can you please explain what is it doing?

  9. #9
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, it's not. Did you read my post?

  10. #10
    Non-Member
    Join Date
    Apr 2009
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First line they are setting errors display ON
    Second line is they are turning error reporting on
    Third line is they are including a file

    But they forgot the closing ?>

    ~


Bookmarks

Posting Permissions

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