아는 것이 좋은 것이다.

[PHP] date 함수 사용 설정 본문

PHP

[PHP] date 함수 사용 설정

start0 2016. 2. 10. 10:10

$year = date("Y");


위와 같이 사용시 아래의 에러를 보는 경우가 있다. (PHP 신규 설치 및 설정 문제)


Warning: date(): 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.


이와 같은 에러의 원인은 timezone 설정이 안되어 있기 때문이다. 


* php 소스상에서 선언

date_default_timezone_set('Asia/Seoul'); //서울기준


* php.ini 설정

date.timezone = Asia/Seoul


php ini의 경우 웹서버를 재시작 해주어야 제대로 적용 된다.

'PHP' 카테고리의 다른 글

[PHP] 자바 class 호출  (0) 2016.02.26
[PHP] 인코딩 관련 깨짐  (0) 2015.03.26
[PHP] 배열에 값 추가  (0) 2015.03.17
[PHP] 페이지내의 모든 변수를 표시  (0) 2015.03.16
[PHP] 코드이그나이터 index.php 삭제하기  (0) 2015.02.13
Comments