a blank page instead of a parse error

Discussion in 'PHP' started by tikitin, Aug 20, 2008.

  1. #1
    Is this something I overlooked when upgrading from PHP 4 to PHP 5?

    If I write a script with a mistake in it (an extra parenthesis),

    <?php
    echo "This is a php-script";
    {
    ?>

    PHP 4 gives an error message:
    Parse error: parse error, unexpected $ in /server/apache/htdocs/errormessage.php on line 3

    PHP 5 returns an absolutely blank page. This is quite inconvenient, when trying to locate something extra or someting missing in a 300 line script.

    I could not find any mention of this in the PHP manual in the chapter which dealt with changes in migrating from 4 to 5.
     
    tikitin, Aug 20, 2008 IP
  2. ahowell

    ahowell Peon

    Messages:
    38
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Check your php.ini file. Make sure you have error reporting on and set to E_ALL
     
    ahowell, Aug 20, 2008 IP
  3. nice.wallpapers

    nice.wallpapers Active Member

    Messages:
    142
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Hi,

    Php 5 is not showing errors as you have to configure it

    If you are working on linux Box then you have to configure error system in this file
    /etc/php.ini

    Thanks :)
     
    nice.wallpapers, Aug 20, 2008 IP
  4. William[ws]

    William[ws] Peon

    Messages:
    47
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If u dont find your php.ini at those locations...

    put a php file with
    <?
    phpinfo();
    ?>
    and grab the location from there... also
    u might wanna check the same directory for a error_log it might go there
     
    William[ws], Aug 20, 2008 IP
  5. olddocks

    olddocks Notable Member

    Messages:
    3,275
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    215
    #5
    are you running php4 and php5 both in local server. did you restart http apache server?
     
    olddocks, Aug 21, 2008 IP
  6. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #6
    Make sure you have display_errors set to on in php.ini.
     
    mwasif, Aug 21, 2008 IP
  7. lfhost

    lfhost Peon

    Messages:
    232
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #7
    or you can just place error_reporting(E_ALL); at the top of the PHP file to display errors.
    If this is a shared box you dont want error reporting always on.
     
    lfhost, Aug 21, 2008 IP
  8. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #8
    If display_errors = off, php will not show the errors even if you have set error_reporting to E_ALL.
     
    mwasif, Aug 22, 2008 IP
  9. lfhost

    lfhost Peon

    Messages:
    232
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #9
    mwasif, my reply was to the initial posting as an offset to making changes in php.ini for error reporting as not everyone has access to it.
    You could also activate it through .htaccess if the server allows it as well as allowing display_errors.
     
    lfhost, Aug 22, 2008 IP