Jump to content

Date, timezone problems after upgrading server to PHP 5.3.27


Tomislav
Go to solution Solved by jcbones,

Recommended Posts

Hi all !

 

I need some help.

I'm not a programer but I would like to solve problem with my website by myself.

After upgrading PHP on server where is my web page ( www.osmrtnica.net ), i'm getting a lot of errors in my CMS.

I hope that someone will have a few minutes to give a look. I have bolded text in code at line 380.

And i know that is a lot of text, but what can i do.

Thanks in advance. 

 

 

here are the errors:

 

<br /><b>Warning</b>:  main() [<a href='function.main'>function.main</a>]: 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 'Europe/Berlin' for 'CEST/2.0/DST' instead in <b>/home2/smiztita/public_html/cms/required/pozdravi_form.php</b> on line <b>380</b><br /><br /><b>Notice</b>:  Use of undefined constant date - assumed 'date' in <b>/home2/smiztita/public_html/cms/required/pozdravi_form.php</b> on line <b>380</b><br /><br /><b>Warning</b>:  strtotime() [<a href='function.strtotime'>function.strtotime</a>]: 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 'Europe/Berlin' for 'CEST/2.0/DST' instead in <b>/home2/smiztita/public_html/cms/required/pozdravi_form.php</b> on line <b>380</b><br /><br /><b>Warning</b>:  strtotime() [<a href='function.strtotime'>function.strtotime</a>]: 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 'Europe/Berlin' for 'CEST/2.0/DST' instead in <b>/home2/smiztita/public_html/cms/required/pozdravi_form.php</b> on line <b>380</b><br /><br /><b>Warning</b>:  date() [<a href='function.date'>function.date</a>]: 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 'Europe/Berlin' for 'CEST/2.0/DST' instead in <b>/home2/smiztita/public_html/cms/required/pozdravi_form.php</b> on line <b>380</b><br /><br /><b>Warning</b>:  date() expects parameter 2 to be long, string given in <b>/home2/smiztita/public_html/cms/required/pozdravi_form.php</b> on line <b>380</b><br />  

And here is a part of code where error ocurs:

 

 <div class="h3" style="height:1px;"> </div>
            <div style="width:450px; float:left; "> 
            <label for="odobreno">odobreno:</label>
            <input type="checkbox" class="chk" name="odobreno" id="odobreno" value="1"<?php if ($row['odobreno'] == 't') { ?> checked="checked"<?php } ?> /> 
            <label for="datum">datum:</label>
            <input type="text" name="datum" id="datum" class="tekst srednji" value="<?php if ($row['datum'] != '') print date('d.m.Y', date.strtotime($row['datum'])); else print date('d.m.Y'); ?>" />
<script type="text/javascript">
                <!--
                    $(document).ready(function(){
                        $('#datum').datepicker({ 
                            mandatory: true,
                            navigationAsDateFormat: true, prevText: '<M', nextText: 'M>',
                            changeMonth: false, 
                            monthNames: ['siječanj ','veljača ','ožujak ','travanj ','svibanj ','lipanj ', 'srpanj ','kolovoz ','rujan ', 'listopad ','studeni ','prosinac '],
                            monthNamesShort: ['sij','velj','ožu','tra','svi','lip','srp','kol','ruj','lis','stu','pro'],
                            changeYear: false,
                            weekHeader: '', showWeeks: true,  
                            dayNames: ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'],
                            dayNamesShort: ['ned', 'pon', 'uto', 'srij', 'čet', 'pet', 'sub'],
                            dayNamesMin: ['N', 'P', 'U', 'S','Č', 'P', 'S'],
                            showOtherMonths: true,
                            numberOfMonths: 1,
                            defaultDate: Date(<?= date('Y, m, d', strtotime($row['datum'])); ?>), // default date - Date(yyyy, mm - 1, dd), 
                            dateFormat: 'dd.mm.yy', 
                            showWeeks: true, firstDay: 1, changeFirstDay: false,  
                            closeText: 'X', 
                            prevText: '<', 
                            nextText: '>',  
                            currentText: ''
                        });
                    });
                //-->
                </script>   
 
 
 
Link to comment
Share on other sites

The error explains what you need to do: "You are *required* to use the date.timezone setting or the date_default_timezone_set() function."

 

So, go to php.ini and set your date.timezone, or make *all your scripts define the timezone using dete_default_timezone_set().

The PHP.ini option is absolutely the best.

Link to comment
Share on other sites

The error explains what you need to do: "You are *required* to use the date.timezone setting or the date_default_timezone_set() function."

 

So, go to php.ini and set your date.timezone, or make *all your scripts define the timezone using dete_default_timezone_set().

The PHP.ini option is absolutely the best.

 I have already done that, here is my php.ini :

 

[Date]
; Defines the default timezone used by the date functions
date.timezone = Europe/Zagreb
Link to comment
Share on other sites

Then your problem is solved?

Almost solved.

Now i got this massage in field where was date written :

 

<br /><b>Notice</b>:  Use of undefined constant date - assumed 'date' in <b>/home2/smiztita/public_html/cms/required/pozdravi_form.php</b> on line <b>380</b><br /><br /><b>Warning</b>:  date() expects parameter 2 to be long, string given in <b>/home2/smiztita/public_html/cms/required/pozdravi_form.php</b> on line <b>380</b><br />

Link to comment
Share on other sites

  • Solution

it isn't date.strtotime() it is just strtotime().  The error is telling you that PHP cannot find a constant named date and thinks it is suppose to be a string.  Then it throws an error that says the second parameter of date() is passed as a string.  Those two clues led me to believe that the "date" part of date.strtotime() was not right.

Link to comment
Share on other sites

it isn't date.strtotime() it is just strtotime().  The error is telling you that PHP cannot find a constant named date and thinks it is suppose to be a string.  Then it throws an error that says the second parameter of date() is passed as a string.  Those two clues led me to believe that the "date" part of date.strtotime() was not right.

Thanks man.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.