php 서버 시간 설정 관련 오류 (strtotime,date ..)
2012. 11. 20. 01:15ㆍLanguages/PHP
아래는 strtotime 함수가 얽혀서 웹서버의 오류 기록(error log)에 남은 경고문이다.
PHP Warning: strtotime(): 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 'Asia/Seoul' for 'KST/9.0/no DST' instead in ...
이는 웹서버의 시간대(timezone) 설정이 되지 않아서 한국(서울) 시간대로 알아서 골랐으니, data.timezone 설정을 하거나 date_default_timezone_set 함수를 써 달라는 내용이다. php 설정 파일인 php.ini에서 data.timezone을 바꿀 수 있는데, 기본값은 아래처럼 주석문으로 되어 있을 것이다.
[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
; date.timezone =
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
; date.timezone =
주석문을 풀고 date.timezone에 'Asia/Seoul'과 같은 값을 넣으면 경고문은 나오지 않는다.
[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = Asia/Seoul
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = Asia/Seoul
'Languages > PHP' 카테고리의 다른 글
Fix `ereg is deprecated` errors in PHP 5.3 (0) | 2012.11.20 |
---|---|
[PHP] Assigning the return value of new by reference is deprecated (0) | 2012.11.20 |
html 태그 제거 (0) | 2012.11.20 |
html 태그를 특수기호 (&npsp; 등) 으로 변환 및 복원 (0) | 2012.11.20 |
php로 엑셀 작성시 숫자를 텍스트 형으로 출력 (0) | 2012.11.20 |