내 php.ini 파일에서이 항목이 있습니다PHP는 date.timezone 명령 줄 스크립트 제대로 작동하지 않는 경우에만
이date.timezone = 'Europe/London';
그러나 내가 명령 줄 스크립트에서 날짜 시간()를 사용할 때마다 내가 아직 도착을 다음과 같은 오류 :
Exception: DateTime::__construct(): 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 'Europe/London' for 'BST/1.0/DST' instead
내가 그러므로 모든 스크립트에서 다음을 수행 할 필요가이 작업을 얻을 :
date_default_timezone_set('Europe/London');
W 모자가이 오류의 원인이 될 수 있습니까? 내가 얻을
<?php
var_dump(ini_get('date.timezone'));
exit;
명령 줄에서 : 웹 브라우저에서
string(0) ""
내가 얻을 :
를UPDATE
은 내가 모두 명령 행 및 웹 브라우저에서 다음을 사용
string(13) "Europe/London"
php.ini 파일을 변경 한 후 서버를 다시 시작 했습니까? –
예. 다시 시작되었지만 값이 잠시 동안 설정되어 있고 그 사이에 여러 번 서버가 다시 시작되었습니다. 이제는 예외가 발생하는 명령 줄 스크립트를 작성할 때만입니다 – user1572427
echo ini_get ('date.timezone')을 시도해 볼 수 있습니까? 실제로 무엇이 설정되어 있는지 확인하십시오. –