Jump to content

Setting PHP time zone results in 500 error.


Recommended Posts

I am working with a brand new installation of 7.4.2. I am running into a issue getting time and date inside of WHMCS to resolve properly.

While I do have the option to set my server time to America/Chicago, it is currently set to UTC. I have several other sites running on this server that have their own unique time zone settings so I do not want to make the change at the server level for multiple reasons.

Based on the documentation I could find, I placed the timezone setting into a php.ini file which had no effect on the information displayed inside of the WHMCS management back end even after a server re-boot. With that solution not working I tried adding both to the beginning and then the end of the .htaccess file

php_value date.timezone 'America/Chicago' 

which results in a site wide 500 error.

Any thoughts on getting the time corrected without changing the time on the entire server?

 

Link to comment
Share on other sites

I opened a trouble ticket on this as my post here was waiting on moderator approval. The reply I received from support suggested adding this line of code to the configuration.php file.

date_default_timezone_set('America/Chicago');

I added this as the last line of code and I can confirm it is working properly in my environment 7.4.2. Your results may vary or break your site. This is a undocumented configuration method, use the aforementioned information accordingly.

 

Link to comment
Share on other sites

1 hour ago, D Martin said:

I opened a trouble ticket on this as my post here was waiting on moderator approval. The reply I received from support suggested adding this line of code to the configuration.php file.


date_default_timezone_set('America/Chicago');

I added this as the last line of code and I can confirm it is working properly in my environment 7.4.2. Your results may vary or break your site. This is a undocumented configuration method, use the aforementioned information accordingly.

 

This is the recommended way to do this indeed 

Many hosts will block ini_set and php_value in .htaccess will have mixed results (hence the 500 error you saw)

Adding that line to your configuration.php (in main whmcs directory) will indeed solve the problem, and you can move this from host to host without any issue. Most hosts won't disable that function

For reference, a link to supported timiezones in php

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated