मैं अपने php.ini फ़ाइल में इस प्रविष्टि है:php date.timezone सही ढंग से कमांड लाइन स्क्रिप्ट के लिए काम न केवल
date.timezone = 'Europe/London';
लेकिन हर बार मैं एक कमांड लाइन स्क्रिप्ट में datetime() का उपयोग मैं अभी भी मिल निम्न त्रुटि:
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');
डब्ल्यू टोपी इस त्रुटि का कारण बन सकती है?
अद्यतन
मैं दोनों कमांड लाइन और वेब ब्राउज़र में निम्नलिखित प्रयोग किया है:
<?php
var_dump(ini_get('date.timezone'));
exit;
कमांड लाइन में मैं मिलता है:
string(0) ""
वेब ब्राउज़र में मैं मिलता है:
string(13) "Europe/London"
क्या आपने php.ini फ़ाइल को बदलने के बाद अपना सर्वर पुनरारंभ किया था? –
हां इसे पुनरारंभ किया गया है लेकिन मान थोड़ी देर के लिए सेट किया गया है और सर्वर को कई बार फिर से शुरू किया गया है। यह केवल तब है जब मैं कमांड लाइन स्क्रिप्ट लिख रहा हूं कि अपवाद – user1572427
हो रहा है क्या आप incho_get ('date.timezone') गूंजने का प्रयास कर सकते हैं; और देखें कि वास्तव में क्या सेट है? –