timezone and session start error after upgrade

I just recently upgraded our php to version 5.3.8

I’m getting a couple errors with our php.

I put this in php.ini


    [Date]
    ; Defines the default timezone used by the date functions
    ; http://php.net/date.timezone
    date.timezone = America/Los_Angeles

I also tried several others I read but none have worked.

But it still says we have a problem with the following.

One of our web php/mysql databases that was written a couple years ago is giving date errors.
We can no longer contact the coder that wrote it and not fully knowing php are at a loss.

I tried to turn display_error = Off, put the “;” in front of error reporting. None that stopped the errors.
I’m hoping someone can help with this. This is also at the top of the page but does not help.

    ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING); // errors only (no notices or warnings)

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/htdocs/utils.php:2) in /var/www/htdocs/check_logged_in.php on line 6

    //check_logged_in.php
    session_start();

    if(!isset($_SESSION['username'])) { // if not logged in
            header("Location: ".CONFIG_BASE_DIR. ""); // redirect to login form from any url
            exit;
    }

Then this error for line 27 & 28

Warning: date() [function.date]: It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Los_Angeles’ for ‘PDT/-7.0/DST’ instead in /var/www/htdocs/utils.php on line 28

    //utils.php line 27 & 28
    $curr_date = date("m/d/Y");  // 05/24/2008
    $curr_time = date("h:i A");    // 05:16 PM

and in another file the following.
Warning: date() [function.date]: It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Los_Angeles’ for ‘PDT/-7.0/DST’ instead in /var/www/htdocs/ip-protection.php on line 18

also lines 49 & 305

    // ip-protection.php

    // Line 18
                // Find today's day and month^M
                $mt = date("m");^M
                $dt = date("j");^M

    // Line 49
    while($row = mysql_fetch_array($result))
            {

                    if (date("d/m/y") == date("d/m/y", $row['date']))
                    {
                            $i = $i + 1;
                    }
                   
                    if ($i >= $m_cap_a_day)
                    {
                            $m_error = "RESET";
                            break;
                    }
            }
    /// and here
    // Line 305

                    while($row = mysql_fetch_array($result))
                    {
                            $dt_today = date("z");
                            $dt = date("z",$row['date']);
                            if (($dt_today - $dt) > $m_ip_days)
                            {
                                    $rec_to_del[$i] = $row['rec_no'];
                            }
                            $i++;
                     }

Thank you in advance.
Bob

First of all, sorry about my english.

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/htdocs/utils.php:2) in /var/www/htdocs/check_logged_in.php on line 6

This warning usually appear when you write something before session_start(),
session_start() must be at the first line, (it’s not real, but if before that something put echo, or write anything at code this warnings appear, inclusive an “\n” or " ")
You can write <?php session_start()?> at begin of main file.

Thank you. Worked great. All I have to do now is get the zimezone & date error fixed.

All my timezone errors fixed.

I put the following in the functions.php all they all went away.

date_default_timezone_set('America/Los_Angeles');

Thanks
Bob

Sponsor our Newsletter | Privacy Policy | Terms of Service