警告:date_default_timezone_get(): [英] Warning: date_default_timezone_get():

查看:26
本文介绍了警告:date_default_timezone_get():的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经研究了我能找到的所有答案,但没有成功让它发挥作用.

I have researched all the answers I can find for this and have had no luck getting it to work.

当我尝试运行 symfony 时出现以下错误.

I am getting the following error when I try to run symfony.

警告:date_default_timezone_get():依赖于系统的时区设置.您需要使用date.timezone 设置或 date_default_timezone_set() 函数.在如果您使用了这些方法中的任何一种并且您仍然得到这个警告,您很可能拼错了时区标识符.我们现在选择时区UTC",但请将 date.timezone 设置为选择您的时区.在/symfony_project/app/cache/dev/classes.php第5229行

Warning: date_default_timezone_get(): 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 /symfony_project/app/cache/dev/classes.php line 5229

我检查了以下内容:

php --ini

配置文件(php.ini)路径:/etc 加载的配置文件:
/etc/php.ini

Configuration File (php.ini) Path: /etc Loaded Configuration File:
/etc/php.ini

我已将 ini 文件更改为 date.timezone = "Europe/Dublin"

I have changed the ini file to date.timezone = "Europe/Dublin"

重启apache清除cli缓存清除浏览器缓存

restarted apache Cleared the cli cache cleared the browser cache

运行phpinfo并确认

Ran phpinfo and confirmed the

加载的配置文件是 etc/php.ini解析的其他 .ini 文件(无)date.timezone = "欧洲/都柏林"我还在浏览器中运行了 echo date_default_timezone_get() 并且我得到了 Europe/Dublin

loaded config file is etc/php.ini Additional .ini files parsed (none) date.timezone = "Europe/Dublin" I also ran echo date_default_timezone_get() in the browser and I get Europe/Dublin

我正在运行 PHP v 5.4.24(它的价值)

I am running PHP v 5.4.24 (for what its worth)

我在里面运行了 echo date_default_timezone_get()它返回 UTC ... 所以看起来 symfony 没有正确读取 php.ini 文件.

I ran echo date_default_timezone_get() inside which returns UTC ... so it looks like symfony is not reading the php.ini file properly.

不知道我还能做什么.

推荐答案

  1. 找到你的 php.ini 文件路径

  1. find your php.ini file path

php -i | grep php.ini

  • edit php.ini date_timezone 设置它是你的时区

  • edit php.ini date_timezone set it is your timezone

    time_zone = "Asia/Shanghai"
    

  • 重启你的 nginxphp-fpm

    这篇关于警告:date_default_timezone_get():的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆