Results 1 to 3 of 3
Jul 27, 2012, 07:41 #1
How do I set the default timezone in php.ini file?
Question. How can I set my php.ini file so that the Eastern Time Zone is the default time zone?
I have a GoDaddy shared hosting. The PHP currently is set with America/Phoenix as the default time zone.
It is running the following PHP version:
PHP Version 5.2.17
GoDaddy's technical support says that I can change the default time zone by adjusting the php.ini. But they said something like I would have to do it myself because changing the php.ini directives was outside of their technical obligations.
Here is what the PHP Manual says:
I have done like the PHP Manual says. I have put the following:
date.timezone = "America/New_York"
in the php.ini file but it won't work.
Here is the entire php.ini file that is in the root folder for the hosting:
register_globals = off
allow_url_fopen = off
expose_php = Off
max_input_time = 60
variables_order = "EGPCS"
extension_dir = ./
upload_tmp_dir = /tmp
precision = 12
SMTP = relay-hosting.secureserver.net
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="
Jul 27, 2012, 08:35 #2
- Join Date
- Jun 2002
- 117 Post(s)
- 0 Thread(s)
Don't forget that you must restart apache once the php.ini has been updated for the settings to take effect. Otherwise, you can use date_default_timezone_set() in your PHP code
Aug 1, 2012, 18:43 #3
Thank you for responding to my question. I can't reboot the server with a shared hosting.
The date_default_timezone_set() function works okay. I just discovered that function recently. Before now I did not realize that there was a function like that.
I was using something like gmdate("Y", time()+($LocalTimeOffset*3600)) in order to get the proper time zone. The date_default_timezone_set() function makes it a lot easier.