使用memcache.php监控memcache后,在页面报时间格式的错误:
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. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in/usr/local/nginx/html/memcache.phpon line 736
根据提示可以列出memecache.php相关的行数内容;
1 | 24 define( 'DATE_FORMAT' , 'Y/m/d H:i:s' ); |
1 | 736 echo '<tr class=tr-0><td class=td-0>Start Time</td><td>' , date (DATE_FORMAT,$memcacheStatsSingle[$server][ 'STAT' ][ 'time' ]-$memcacheStatsSingle[$server][ 'STAT' ][ 'uptime' ]), '</td></tr>' ; |
解决办法:
1 | 24 define( 'DATE_FORMAT' , 'Y/m/d H:i:s' ); |
之上增加一行
date_default_timezone_set("PRC");
其他方法,例如在php.ini中设置date.timezone的值,无论怎么设置和重启PHP-FPM进程都不生效,这点比较奇怪;
點擊查看更多內容
為 TA 點贊
評論
評論
共同學習,寫下你的評論
評論加載中...
作者其他優質文章
正在加載中
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦