date_default_timezone_set(”Asia/Bangkok”);

จู่ๆ โปรแกรมที่ข้าเจ้าเขียนก็มี ข้อความเตือนประมาณนี้ ลักษณะเหมือนไม่ได้ Set timezone(เวลาในพื้นที่) หรือใครไป config อะไรสักอย่าง แต่ก่อนไม่มี เดี๋ยวนี้มีเป็นของตัวเอง “เฮ้ยยยยอารายเนี่ย….T_T”

Strict Standards: phpinfo() [function.phpinfo]: It is not safe to rely on the system’s timezone settings. Please use the date.timezone setting, the TZ environment variable 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/Bangkok’ for ‘ICT/7.0/no DST’ instead

เอาล่ะมาดูซิว่าเกิดอะไรขึ้น phpinfo เปิดดูหน่อย…

date_default_timezone_set

เมื่อรู้แล้วว่า “no value” ก็ เปิดไฟล์ php.ini แล้วหาคำว่า date.timezone และ set เป็น “Asia/Bangkok” เพราะเราคือคนไทย (หมายถึง server อยู่ที่ไทย)

date.timezone = Asia/Bangkok

อย่าลืม restart Apache เด้อ
ปิ้ว…. ผมไม่มีสิทธิ์แก้ไฟล์ php.ini อ่ะ เลยมีวิธีที่สอง ก็พิมพ์คำสั่งนี้ไว้บนบรรทัดแรกของไฟล์ซะเลย

date_default_timezone_set("Asia/Bangkok");

เรียบร้อย…ไปดูหนังต่อดีกว่า อุอุ…

You can leave a response, or trackback from your own site. Responses are currently closed, but you can trackback from your own site. You can skip to the end and leave a response. Pinging is currently not allowed. Both comments and pings are currently closed.
Powered by WordPress | Shop Free T-Mobile Phones Online | Thanks to Verizon Phones without Contract, MMORPG Games and Sell Car