#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    MA, USA
    Posts
    64
    Rep Power
    17

    php.ini err? PHP works but a parse error shows a blank page...


    v-- A bit of background - skip if you're skimming:
    Last night, after realizing that my current installation of PHP (CGI, 4.2.x, IIS 5.0 on Win2k Pro) did not include the APPL_PHYSICAL_PATH server variable (which ASP returned but PHP did not and which I use quite often), I downloaded the latest version of PHP (4.3.4) and installed it using the ISAPI option.
    ^-- END: Background

    Now, I know PHP is working because I can run a bunch of my PHP pages and phpinfo() runs as expected. However, I started noticing that any error's (Parse or otherwise) would cause a blank page to appear - no errors, nothing! I have just about ALL of the logging options turned on in my php.ini, but nothing gets output to screen, nothing appears in my log file and nothing shows up in my SysLog either. I've restarted both the server and the box itself, but still no luck. Any thoughts as to the cause?

    Just for giggles, here's a copy of my logging and error settings:
    Code:
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Error handling and logging ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ; error_reporting is a bit-field.  Or each number up to get desired error
    ; reporting level
    ; E_ALL             - All errors and warnings
    error_reporting  = E_ALL
    
    ; Print out errors (as a part of the output).  For production web sites,
    ; you're strongly encouraged to turn this feature off, and use error logging
    ; instead (see below).  Keeping display_errors enabled on a production web site
    ; may reveal security information to end users, such as file paths on your Web
    ; server, your database schema or other information.
    display_errors = On
    
    ; Even when display_errors is on, errors that occur during PHP's startup
    ; sequence are not displayed.  It's strongly recommended to keep
    ; display_startup_errors off, except for when debugging.
    display_startup_errors = On
    
    ; Log errors into a log file (server-specific log, stderr, or error_log (below))
    ; As stated above, you're strongly advised to use error logging in place of
    ; error displaying on production web sites.
    log_errors = On
    
    ; Set maximum length of log_errors. In error_log information about the source is
    ; added. The default is 1024 and 0 allows to not apply any maximum length at all.
    log_errors_max_len = 1024
    
    ; Do not log repeated messages. Repeated errors must occur in same file on same
    ; line until ignore_repeated_source is set true.
    ignore_repeated_errors = Off
    
    ; Ignore source of message when ignoring repeated messages. When this setting 
    ; is On you will not log errors with repeated messages from different files or
    ; sourcelines.
    ignore_repeated_source = Off
    
    ; If this parameter is set to Off, then memory leaks will not be shown (on
    ; stdout or in the log). This has only effect in a debug compile, and if 
    ; error reporting includes E_WARNING in the allowed list
    report_memleaks = On
    
    ; Store the last error/warning message in $php_errormsg (boolean).
    track_errors = Off
    
    ; Disable the inclusion of HTML tags in error messages.
    html_errors = On
    
    ; If html_errors is set On PHP produces clickable error messages that direct 
    ; to a page describing the error or function causing the error in detail.
    ; You can download a copy of the PHP manual from http://www.php.net/docs.php 
    ; and change docref_root to the base URL of your local copy including the
    ; leading '/'. You must also specify the file extension being used including 
    ; the dot.
    ;docref_root = "/phpmanual/"
    ;docref_ext = .html
      
    ; String to output before an error message.
    error_prepend_string = "<font color=ff0000>"
    
    ; String to output after an error message.
    error_append_string = "</font>"
    
    ; Log errors to specified file.
    error_log = C:\Program Files\PHP-4.3.4\error.log
    
    ; Log errors to syslog (Event Log on NT, not valid in Windows 95).
    error_log = syslog
    "Once begun, half done." - EP
  2. #2
  3. Retired
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Finland
    Posts
    9,115
    Rep Power
    2496
    Do you have an example of a script with an error?

    Do you use the @ sign before any of your functions -> this can cause blank screen as it supressses the error messages and if it kills the script, then you can't tell what is up.

    Cheers,
    Jamie

    >_ My Music Blog | Losing weight @notsoheavyblog | My Tweets

    __________________

    Let the might of your compassion arise to bring a quick end
    to the flowing stream of the blood and tears .....
    Please hear my anguished words of truth.

    __________________
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    MA, USA
    Posts
    64
    Rep Power
    17
    I purposely included an error in my script just to test it out. The error is displayed as expected on the production server, but on the server I mentioned above I only get the blank page.

    Here's the bad line:
    Code:
    <?php
    //Make sure this stays at the top of every page.
    require_once($_SERVER["APPL_PHYSICAL_PATH"]."_includes/common_funcs.php");
    require_once($_SERVER["APPL_PHYSICAL_PATH"]."_includes/smf_db.php");
    
    session_start();
    session_cache_expire(20
    ?>
    As you can see, the last line should err since it's missing the ending ")" and the ";". Instead, I get this (using View Source):
    Code:
    ...
    Dammit! I just went to test it again so that I could View Source on the output and now it's working. The only thing I did differently between last night and this morning was to shut the server down completely and then bring it back up when I got into work.

    Still, I see this problem mentioned a few times on several BB's, so any thoughts on this would help someone out, if not me.

    Well, thanks for making me check it again, anyways
    "Once begun, half done." - EP
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    UK
    Posts
    311
    Rep Power
    15
    Make the following change in php.ini
    Code:
    error_log = C:\Program Files\PHP-4.3.4\error.log
    to
    error_log = "C:\Program Files\PHP-4.3.4\error.log"
    The quotes are important if the path contains blank spaces (ie \program files\).
    That's probably why PHP isn't logging to a file.

    As for why errors aren't showing on screen (html errors). That might (I doubt it though) be because your path to the manual isn't specified (ie commented out). try:
    Code:
    docref_root = "C:\Program Files\PHP-4.3.4\manual\"
    docref_ext = .html
    Google :: Apache Manual :: FreeBSD Handbook
    SourceHack :: SourceHack Forums :: SourceHack IRC
    UNIX is simple; it just takes a genius to understand its simplicity!!!
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    MA, USA
    Posts
    64
    Rep Power
    17
    Thanks kola. I'll add the quotes and see if that helps with the log file problem.

IMN logo majestic logo threadwatch logo seochat tools logo