Forums / Install & configuration / Timezone on php5 "Strict Standards: strtotime()" - Solved -

Timezone on php5 "Strict Standards: strtotime()" - Solved -

Author Message

jeppe linkas

Moderated by: Nicolas Pastorino

Tuesday 22 May 2007 6:51:59 pm

Hello

I'm looking at ez on php5 ( http://pubsvn.ez.no/nextgen/unstable/2007-03-21-php5/ its not this url NB NB)
and I ran into som problem in the setup. It seem to me that either is the problem on the server time setup or in somewhere in ez. I'm installing ez on a hosted server so
I'm having problems getting info about the server setup. Anyone know if this may be a Ez "problem" in unstable, or is this solely a server issue?

This is the error msg:

Strict Standards: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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 /opt/lampp/htdocs/killhack/lib/ezutils/classes/ezdebug.php on line 898

Strict Standards: strftime() [function.strftime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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 /opt/lampp/htdocs/killhack/lib/ezutils/classes/ezdebug.php on line 898

If this is a server issue, a pointer to workaround in EZ would be nice since I have no controle over the hosted server environment.

Any help and pointers is very much appreciated

Kristof Coomans

Tuesday 22 May 2007 10:41:46 pm

Hi Jeppe

Welcome to the eZ community!

Are you using the official eZ publish releases from http://ez.no/download/ez_publish or the unsupported PHP 5 port ( http://pubsvn.ez.no/svnparent/nextgen_php5/ )?

There are only official releases that work on PHP 4, and I didn't saw this warning yet on PHP 4 so I guess you're running PHP 5. Only the unsupported PHP 5 port will work on it.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

jeppe linkas

Wednesday 23 May 2007 6:02:37 am

With a little help from my god new mates i found on #ezpublish @ freenode.net the problem was solved

The problem was in the php.ini file you most go to:
and roll down to you se.

;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;

[Date]
date.timezone = CET

and add [Date] date.timezone = CET and save and restart the webserver

I hope this can be useful for others

Thanks for help guys!

Piotr S.

Tuesday 11 September 2007 11:40:54 am

Thanks "jeppe", I've got the same problem. With your help I can go forward with my work.
Regards

Jeremy B.

Thursday 11 October 2007 1:03:55 am

Thanks

optimex prime

Saturday 03 November 2007 2:08:25 am

This solution is only suited for those having access to their php.ini file on the server hosting their EZ install. But on a shared hosting you absolutely can not do that and you have to press "refresh" on every new page to make the error message disapear... is there a more radical way to solve the problem on shared hosting. I am talkin EZ publish 4alpha2 here!?

André R.

Saturday 03 November 2007 3:18:18 am

If you look in this post:
http://ez.no/developer/forum/developer/ezpublish_unstable_php5_vers_configuration_problem/re_ezpublish_unstable_php5_vers_configuratio__6

Heath mentions a way to set it from your apache config files, so you might try setting it in your .htaccess file:

   php_value date.timezone America/Chicago 
   php_value magic_quotes_gpc 0 
   php_value magic_quotes_runtime 0

If that doesn't work you can hack index.php and set the timezone in the beginning of the file. I know there is a example somewhere in the forum, but couldn't find it, so search for it (timezone) on php.net for an example!

EDIT: Instead of hacking, it is better to just set it in config.php. A php file you place in the root of the installation, witch is included by autoload.php. But if you only need one timezone setting for the whole installation, put the setting in settings/override/site.ini.append.php as mentioned by Knut and me bellow.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Knut Urdalen

Saturday 03 November 2007 6:31:58 am

As far as I can see you can solve this by setting the TimeZone directive in TimeZoneSettings in site.ini (http://ez.no/doc/ez_publish/technical_manual/3_10/reference/configuration_files/site_ini/timezonesettings/timezone).

According to the PHP manual (http://php.net/datetime):

<i>"The default timezone used by all date/time functions if the TZ environment variable isn't set."</i>

index.php in eZ Publish do only set TZ environment variable if it's set in the config.

// Set correct site timezone                                                                                                                                                                                                                                                        
$timezone = $ini->variable( "TimeZoneSettings", "TimeZone");
if ( $timezone )
{
    putenv( "TZ=$timezone" );
}

My suggestion to this topic is that setting the timezone should be a part of the installer for eZ Publish 4 and it should have a better error message if time zone is not set for some reason.

Tony Wood

Tuesday 25 December 2007 4:19:01 am

Thanks. This really helped.

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

olagato olagato

Tuesday 05 February 2008 4:59:34 am

At new version 4.0.0, on a XAMPP local host
Add this at /settings/site.ini file next lines:

[Date]
date.timezone = CET

Also added these:
[Date]
; Defines the default timezone used by the date functions
;date.timezone = CET

at "php.ini" files

André R.

Tuesday 05 February 2008 5:52:38 am

> Add this at /settings/site.ini file next lines:

1. Put it in '/settings/override/site.ini.append.php' instead so you don't have to redo it each time you update eZ Publish!
2. the settings you are talking about is php.ini specific, not site.ini. If don't have access to change php.ini, then this is the setting you want to put in site.ini.append.php:

[TimeZoneSettings]
TimeZone=CET

3. The settings you placed in php.ini is commented out (';'), so they won't work.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Goran Sabo

Monday 05 May 2008 7:32:47 am

Hi!
I'm new in ez user.
I try to install it but dont go :-(
Does anybody have info where I get worked and without errorr install package ezpublish.
sorry for my english

by by

Nate Biggs

Saturday 17 May 2008 5:14:11 pm

I am having the same problem.. though it is when I try to install eZ Publish 4.0

I have tried a number of things in this thread (or what I interpret your instructions to be) but find either they're not working, or I am not understanding the directions well enough.. My specific error is
Strict Standards: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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 /home/spora3/public_html/content/ezpublish-4.0.0/lib/ezutils/classes/ezdebug.php on line 879

and it cascades down the page, nicely, about 40 times before I get to the installation portion.. I am able to run through the install, even with the error messages, but after I complete installation when I hit the main page it times out with an eZ error. I'm not sure if this is related or not..

Could you please provide some clear instructions as to how to resolve this issue?

Thanks.

Nate Biggs

Sunday 18 May 2008 12:20:21 am

It was fixed by adding this line
SetEnv TZ location
to the .htaccess file.

James Ward

Tuesday 03 June 2008 8:42:03 pm

So this problem existed in an unstable version a year ago and is still present in the current stable release? That is disgraceful.

working at www.wardnet.com
blogging at www.jamesward.ca

Kristof Coomans

Tuesday 03 June 2008 10:35:48 pm

Actually, this is a PHP problem, and not an eZ Publish problem. However, there are solutions, as already explained by other people in this topic:
- make sure you add the required PHP setting either in your php.ini or in the apache virtual host configuration
- adjust the PHP setting manually in conf.php

Issue report: http://issues.ez.no/12027. Please comment there with any suggestions you might have.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Bruce Morrison

Tuesday 03 June 2008 10:47:13 pm

Hi James

As Kristof points out it's a PHP config issue ( I wouldn't call it a problem ). There is nothing for eZ to do as the TZ for any installation could be different.

The only disgraceful thing is that you haven't setup your PHP installation correctly ;)

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

James Ward

Wednesday 04 June 2008 7:46:00 am

OK Fair enough. There is no way to catch this issue during fine tuning and present the user with a recommended fix as we do with the directory permissions?

working at www.wardnet.com
blogging at www.jamesward.ca

James Ward

Thursday 05 June 2008 7:50:19 am

Bruce,
Thanks for moving my recommendation into the bug report. Perhaps disgraceful was a bit harsh but I just returned from DC Php where I was extolling the virtues of eZ Pub only to have everyone who I convinced to give a try come back to me reporting ugly errors on the first page. Not a good first impression and in my opinion very worthy of the eZ crew's attention.

Cheers.

working at www.wardnet.com
blogging at www.jamesward.ca

Bruce Morrison

Thursday 05 June 2008 4:38:08 pm

Hi James

If the install instructions are followed then it's not a problem:
http://ez.no/doc/ez_publish/technical_manual/4_0/installation/normal_installation/requirements_for_doing_a_normal_installation#eztoc86403_2_6 and from doc/INSTALL

The date.timezone directive must be set in php.ini or in .htaccess. For a list of supported timezones please see  http://php.net/manual/en/timezones.php

Though a highlighted direct link to the install instructions from the download page would be helpful. It took a bit of searching to find the page.

Reminds me of the recent study reported in this article:
http://www.engadget.com/2008/06/03/95-percent-of-all-returned-gadgets-still-work-americans-dont-r/

And it's true, people don't read install instructions or manuals and this is where it's up to the products to be as usable as possible.

Unfortunately for eZ publish it ( usually ) will not work with vanilla installations, the PHP memory_limit is something they you've always had to increase before doing an install.

This is one of those things that just doesn't occur with other PHP based CMS's where the install process just works "out of the box". This is half the battle, and I've talked to a number of people that never got past the install stage, and have a negative impression of eZ publish and will not go back.

So when I'm recommending eZ Publish to people I emphasise that there are some pre-install tweaks required.

BTW I added the comment to the bug report at the same time as my reply, well before your post with the suggestion. Great minds and all that :)

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish