登录OSB管理页面时报date_default_timezone_set()解决方法

简介:

登录OSB管理页面时报时区错误如下:

Warning: date() [function.date]: 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 had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm in /apps/oracle/OSBackup/apache/htdocs/php/common.php on line 1963

Warning: date() [function.date]: 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 had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm in /apps/oracle/OSBackup/apache/htdocs/php/common.php on line 1964

Warning: date() [function.date]: 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 had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm in /apps/oracle/OSBackup/apache/htdocs/php/common.php on line 1965

Warning: strftime() [function.strftime]: 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 had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm in /apps/oracle/OSBackup/apache/htdocs/php/common.php on line 1966

Warning: date() [function.date]: 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 had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm in /apps/oracle/OSBackup/apache/htdocs/php/common.php on line 1968

Cause: 
这是因为PHP所取的时间是格林威治标准时间,所以和你当地的时间会有出入格林威治标准时间和北京时间大概差8个小时左右,我们可以按照下面的方法解决。 

解决办法: 

1、在页头使用date_default_timezone_set()设置我的默认时区为北京时间,即 

<?php 

date_default_timezone_set("PRC"); 

?>就可以了。 

2、在php.ini中设置date.timezone的值为PRC,设置好以后的为:date.timezone=PRC,同时取消这一行代码的注释,即去掉前面的分号就可以了。

 

打开php5.ini查找date.timezone 去掉前面的分号 = 后面加XXX,重启http服务(如apache2或iis等)即可。
XXX可以任意正确的值。对于我们国内来 说:可以为以下值:Asia/Chongqing ,Asia/Shanghai ,Asia/Urumqi (依次为重庆,上海,乌鲁木齐)港台地区可用:Asia/Macao ,Asia/Hong_Kong ,Asia/Taipei (依次为澳门,香港,台北),还有新加坡:Asia/Singapore,当然PRC也行。

 



     本文转自vcdog 51CTO博客,原文链接:http://blog.51cto.com/255361/837484,如需转载请自行联系原作者



相关文章
|
9月前
|
NoSQL Redis 开发工具
redis WARNING overcommit_memory is set to 0 问题解决方法
redis WARNING overcommit_memory is set to 0 问题解决方法
310 0
关于 CMake编译出出现错误“Could not find compiler set in environment variable RC:” 的解决方法
关于 CMake编译出出现错误“Could not find compiler set in environment variable RC:” 的解决方法
关于 CMake编译出出现错误“Could not find compiler set in environment variable RC:” 的解决方法
|
关系型数据库 MySQL 数据库
MySQL 数据库mysqlbinlog使用问题:unknown variable ‘default-character-set=utf8‘.解决方法
MySQL 数据库mysqlbinlog使用问题:unknown variable ‘default-character-set=utf8‘.解决方法
321 0
|
关系型数据库 Oracle MySQL
OGG-03517 Conversion from character set failed解决方法
用goldengate同步oracle数据到mysql,由于一个字段某行数据的字段集的原因导致 replicat进程报 OGG-03517错 OGG-03517  Conversion from character set zhs16gbk of source column LPL_MERCHAN...
1718 0
|
6天前
|
存储 安全 Java
java集合框架复习----(4)Map、List、set
这篇文章是Java集合框架的复习总结,重点介绍了Map集合的特点和HashMap的使用,以及Collections工具类的使用示例,同时回顾了List、Set和Map集合的概念和特点,以及Collection工具类的作用。
java集合框架复习----(4)Map、List、set
|
17天前
|
存储 JavaScript 前端开发
ES6新特性(四): Set 和 Map
ES6新特性(四): Set 和 Map