<bdo id='KYB0E'></bdo><ul id='KYB0E'></ul>

    1. <legend id='KYB0E'><style id='KYB0E'><dir id='KYB0E'><q id='KYB0E'></q></dir></style></legend>

        <small id='KYB0E'></small><noframes id='KYB0E'>

        <i id='KYB0E'><tr id='KYB0E'><dt id='KYB0E'><q id='KYB0E'><span id='KYB0E'><b id='KYB0E'><form id='KYB0E'><ins id='KYB0E'></ins><ul id='KYB0E'></ul><sub id='KYB0E'></sub></form><legend id='KYB0E'></legend><bdo id='KYB0E'><pre id='KYB0E'><center id='KYB0E'></center></pre></bdo></b><th id='KYB0E'></th></span></q></dt></tr></i><div id='KYB0E'><tfoot id='KYB0E'></tfoot><dl id='KYB0E'><fieldset id='KYB0E'></fieldset></dl></div>

        <tfoot id='KYB0E'></tfoot>
      1. 尽管时区有效,但设置默认时区不起作用

        Setting default timezone does not work despite timezone being valid(尽管时区有效,但设置默认时区不起作用)

        1. <tfoot id='nVCih'></tfoot>

          <small id='nVCih'></small><noframes id='nVCih'>

            <tbody id='nVCih'></tbody>

                <legend id='nVCih'><style id='nVCih'><dir id='nVCih'><q id='nVCih'></q></dir></style></legend>
                • <bdo id='nVCih'></bdo><ul id='nVCih'></ul>

                  <i id='nVCih'><tr id='nVCih'><dt id='nVCih'><q id='nVCih'><span id='nVCih'><b id='nVCih'><form id='nVCih'><ins id='nVCih'></ins><ul id='nVCih'></ul><sub id='nVCih'></sub></form><legend id='nVCih'></legend><bdo id='nVCih'><pre id='nVCih'><center id='nVCih'></center></pre></bdo></b><th id='nVCih'></th></span></q></dt></tr></i><div id='nVCih'><tfoot id='nVCih'></tfoot><dl id='nVCih'><fieldset id='nVCih'></fieldset></dl></div>

                • 本文介绍了尽管时区有效,但设置默认时区不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我只是在做 phpinfo() 时得到的

                  I'm geting when I just do phpinfo()

                  警告:phpinfo():依赖系统的时区设置是不安全的.您需要使用 date.timezone 设置或 date_default_timezone_set() 函数.如果您使用了这些方法中的任何一种,但仍然收到此警告,您很可能拼错了时区标识符.我们在第 8 行的/myadmin/i.php 中为EET/2.0/no DST"选择了Europe/Helsinki"

                  Warning: phpinfo(): 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/Helsinki' for 'EET/2.0/no DST' instead in /myadmin/i.php on line 8

                  这里是 i.php:

                  <?php
                  //echo date_default_timezone_get();
                  
                  date_default_timezone_set("Europe/Kiev");
                  
                  //echo date("l");
                  
                  phpinfo();
                  ?>
                  

                  如您所见,当我执行 date_default_timezone_set("Europe/Kiev") 时,我得到:

                  And as you can see, when I do date_default_timezone_set("Europe/Kiev") I get:

                  注意:date_default_timezone_set():时区 ID 'Europe/Kiev' 在/myadmin/i.php 第 4 行无效

                  Notice: date_default_timezone_set(): Timezone ID 'Europe/Kiev' is invalid in /myadmin/i.php on line 4

                  我确定我使用的是来自 here,我确实设置了:

                  I'm sure I'm using valid timezone string from here, and I did set :

                  date.timezone = 欧洲/基辅

                  date.timezone = Europe/Kiev

                  在 php.ini 文件中.

                  in php.ini file.

                  环境:CentOS 6,nginx/1.1.11,PHP 5.3.8 (fpm-fcgi)

                  Environment: CentOS 6 , nginx/1.1.11 , PHP 5.3.8 (fpm-fcgi)

                  我真的不明白这是怎么回事.谢谢.

                  I really can't understand what's a matter. Thank you.

                  推荐答案

                  感谢评论,我能够解决我的问题.我在控制台中做了什么:

                  Thanks to the comments, I was able to solve my problem. What I've done, in console:

                  #yum install php-pear
                  
                  #pecl install timezonedb
                  

                  需要c编译器:

                  configure: error: no acceptable C compiler found in $PATH
                  

                  ...所以我做了:

                  #yum install gcc
                  

                  另外,如果您收到有关 make 命令的错误,只需运行

                  Also, if you get an error about the make command, simply run

                  #yum install make
                  

                  最后,再试一次:

                  #pecl install timezonedb
                  

                  ...它显示在末尾:

                  You should add "extension=timezonedb.so" to php.ini
                  

                  我将extension=timezonedb.so"添加到/etc/php.ini,并重启了php-fpm:

                  I added "extension=timezonedb.so" to /etc/php.ini, and restarted php-fpm:

                  #/etc/init.d/php-fpm restart
                  

                  这篇关于尽管时区有效,但设置默认时区不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Converting string to MySQL timestamp format in php(在php中将字符串转换为MySQL时间戳格式)
                  datetime to timestamp(日期时间到时间戳)
                  PHP timestamp date to user timezone(PHP时间戳日期到用户时区)
                  Converting TIMESTAMP to unix time in PHP?(在 PHP 中将 TIMESTAMP 转换为 unix 时间?)
                  Convert ISO 8601 to unixtimestamp(将 ISO 8601 转换为 unixtimestamp)
                  Finding days between 2 unix timestamps in php(在php中查找2个unix时间戳之间的天数)

                  <small id='SQVnT'></small><noframes id='SQVnT'>

                  1. <tfoot id='SQVnT'></tfoot>
                      <tbody id='SQVnT'></tbody>

                      <i id='SQVnT'><tr id='SQVnT'><dt id='SQVnT'><q id='SQVnT'><span id='SQVnT'><b id='SQVnT'><form id='SQVnT'><ins id='SQVnT'></ins><ul id='SQVnT'></ul><sub id='SQVnT'></sub></form><legend id='SQVnT'></legend><bdo id='SQVnT'><pre id='SQVnT'><center id='SQVnT'></center></pre></bdo></b><th id='SQVnT'></th></span></q></dt></tr></i><div id='SQVnT'><tfoot id='SQVnT'></tfoot><dl id='SQVnT'><fieldset id='SQVnT'></fieldset></dl></div>
                      <legend id='SQVnT'><style id='SQVnT'><dir id='SQVnT'><q id='SQVnT'></q></dir></style></legend>
                          <bdo id='SQVnT'></bdo><ul id='SQVnT'></ul>