How to change the time in apache server so it matches the computer's time (PHP)?

I believe you are looking for: date_default_timezone_set ( string $timezone_identifier )

Link

You can also set this in your php.ini config.


Open the php.ini under /etc/php.ini .

Uncomment this line and add your continent and the main city. Here is an example which works for Germany (Deutschland).

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/Berlin

See the website http://php.net/manual/de/timezones.php for all timezones in German.

Save the file php.ini. And restart the apache. Mageia LINUX uses this:

systemctl restart httpd.service

You need to do this in your php.ini file. I am on windows and run WAMP so my php.ini location is at: c:/wamp/bin/apache/Apache2.2.21/bin/

You then open that file and the default is set to: date.timezone = UTC You would change this value for whatever timezone you want...

For a full list of timezones supported, you can visit: http://php.net/manual/en/timezones.php

Tags:

Php

Apache