logo
Apache Lounge
Webmasters

 


About

Forum Index Downloads Search Register Log in  RSS Apache Lounge
 



Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.



phpinfo(): It is not safe to rely on the timezone

 
Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner



View previous topic :: View next topic  
Author Message
zontar999



Joined: 30 Apr 2014
Posts: 11

PostPosted: Wed 28 May '14 20:38    Post subject: phpinfo(): It is not safe to rely on the timezone Reply with quote

Installed 01 May 2014, PHP 5.5.12
Installed Apache/2.4.9 (Win64) PHP/5.5.12

Configured php.ini.
Can run php scripts without a problem. EXCEPT for the following message.

"Warning: phpinfo(): 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone."

I have added the following into php.ini

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

I have placed the above value in single quotes, double quotes and countless other punctuation characters. No luck.

I Google the message I get back thousands of threads with a hundred solution each. Some for Unix. Linux. Windows

I am look for a proven solution or at least a confirmation that I am overlooking something and that there is a flaw in this build of PHP. I am thinking of going back a generation.

Any PROVEN solutions would be appreciated.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 6202
Location: Germany, Next to Hamburg

PostPosted: Wed 28 May '14 21:49    Post subject: Reply with quote

date.timezone = "America/New_York"

is correct. Don't forget to restart your webserver
Back to top
zontar999



Joined: 30 Apr 2014
Posts: 11

PostPosted: Wed 28 May '14 22:24    Post subject: Reply with quote

Nope. As mentioned earlier thread I have add your recommended string. With quotes. Without. Restarted the server and still the same problem.

I add the date_default command it script works. Pull that line it generates the warning.

<?
date_default_timezone_set('America/New_York');
echo phpinfo();
?>

I DO NOT have the problem on a Linux server running php 5.3.13

Not belabor the obvious but I have spent days researching this problem and am looking for a concise resolution or confirmation that this build of PHP is not sound.

As another example the following script fails under Windows and not the Linux server

<?
echo extract($HTTP_GET_VARS);
echo extract($HTTP_POST_VARS);
?>
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 6202
Location: Germany, Next to Hamburg

PostPosted: Thu 29 May '14 11:20    Post subject: Reply with quote

zontar999 wrote:


<?
echo extract($HTTP_GET_VARS);
echo extract($HTTP_POST_VARS);
?>


The $HTTP_*_VARS no longer exist in PHP 5.5
please use $_GET and $_POST. $HTTP_*_VARS were even depricated in 5.3.

You are still using <? instead of <?php ? Did you enable short tags in your php.ini ?

zontar999 wrote:

confirmation that this build of PHP is not sound.



where did you download your php?
Back to top
zontar999



Joined: 30 Apr 2014
Posts: 11

PostPosted: Thu 29 May '14 15:58    Post subject: Reply with quote

Many thanks for the update on deprecation of $HTTP get and post! I believe that I got this version of PHP from the PHP.net. I has been a while. Again thank you for the clarification.
Back to top
jArden



Joined: 13 Jul 2015
Posts: 3
Location: Greece,Athens

PostPosted: Wed 15 Jul '15 14:59    Post subject: Reply with quote

Just a note , from PHP 5.4 <? and of course <?= is always available regardless of the short_open_tag ini setting.
Back to top


Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner
Page 1 of 1