문제

I recently subscribed to OpenShift and deployed a new php 5.4 application, everything works fine, but I can't seem to change the default GMT php timezone.

Here's where this GMT timezone is defined:

> grep timezone ~/php/configuration/etc/php.ini

date.timezone = GMT

I'm able to edit this php.ini file and update the timezone to my desired value (America/Montreal), but as soon as the php cartridge is restarted (simply by doing a git push or issuing 'ctl_app restart' command on the server for ex), there's an unknown process that restores the php.ini back to openshift factory defaults, so I loose my changes and the timezone is back to GMT.

Any idea?

Thanks

도움이 되었습니까?

해결책

You can use ini_set() to modify php.ini settings at run time. The modification will be valid only for the current run.

ini_set('date.timezone', 'america/new_york');
ini_set('date.timezone', 'europe/london');
ini_set('date.timezone', 'america/sao_paulo');
... etc.

This setting will affect behaviour of date and time functions like date().

Here is a list of supported timezones.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top