Ok I have a VPS running Ubuntu Server 12.10 32Bit and I need to set the timezone in my PHP.ini file so my PHP Script's time and date features will work (I am trying to setup ModX) I have tried to go to /etc/php5 and change it in different files and it won't work. How do I change PHP's timezone. Also everything in the .ini file has a ; in front of it is that a comment or what? Also I forgot to mention that my webserver in installed via tasksel as LAMP.
2 Answers
find your php.ini and change the value of date.timezone = Europe/Berlin
Edit(Thanks to @awashburn for his comment): the php-cli's php.ini file is different then apache2's php.ini file. I suggest symbolic linking one to another to keep them in sync and avoid confusion!
-
Which .ini file do I use? Where is the file located for Apache2? Feb 23, 2013 at 17:32
-
I use xampp myself. but in your case I think it is in
/etc
, try t o search in your filesystem withfind | grep php.ini
Feb 23, 2013 at 17:34 -
Ok please refersh this page in 10 minutes as I am going to try /etc/apache2/php.ini then restart my VPS and see if that works. Feb 23, 2013 at 17:35
-
1Note: the
php-cli
'sphp.ini
file is different thenapache2
'sphp.ini
file. I suggest symbolic linking one to another to keep them in sync and avoid confusion! Feb 15, 2014 at 19:43 -
3
1) Find the right php.ini
file
Apache
Create a file info.php
with this content:
<?php
phpinfo();
Then open the file from a web browser and find the row Loaded Configuration File.
CLI
Just run this command:
$ php --ini
2) Change the timezone value in the php.ini
Open the right php.ini
file, search for the date.timezone =
value (usually under the [Date]
section), and set:
date.timezone = Europe/Berlin