开发者

Change to php.ini does not have effect

开发者 https://www.devze.com 2023-03-16 15:23 出处:网络
I added this line to my php.ini file: date.timez开发者_高级运维one = \"Europe/Rome\". But phoinfo() still show me this: date.timezone America/Phoenix America/Phoenix.

I added this line to my php.ini file: date.timez开发者_高级运维one = "Europe/Rome".

But phoinfo() still show me this: date.timezone America/Phoenix America/Phoenix.

Where I'm wrong?


Did you restart your web server? php.ini is only evaluated when the server starts up.


You have to restart Apache (or whatever server you use).


You can also set time zone from your script in case you don't have permission to restart the server:

<?php
date_default_timezone_set('America/Phoenix');
//rest of your code. 
?>

And here the list of supported time zones by PHP.


Is this a discrepancy between command-line execution of PHP versus the regular viewing from a browser? CLI and web instances can read from different .ini files in some cases.

You'll want to find the 'loaded configuration file' using phpinfo()

From command line in Windows:

php.exe -i "phpinfo()" | find ".ini"

For Linux I believe:

php -i "phpinfo()" | grep ".ini"


GoDaddy just did this to me too. The new PHP5 post vars limit broke some of my forms. So I needed to change the max_input_vars setting. I updated the php5.ini file and then had to wait (a few minutes in my case) for the new setting to take effect.


You need to change the date.timezone = Europe/Rome in phpForApache.ini like you did to php.ini.

0

精彩评论

暂无评论...
验证码 换一张
取 消