PHP: How to read the current date / time of the server, no php.ini


Here is my problem:

echo date('Y-m-d H:i:s');
echo date('Y-m-d H:i:s', mktime());  

echo exec('date');

The output is:

2012-03-21 08:45:51
2012-03-21 08:45:51

Wed Mar 21 10:45:51 EDT 2012

Server time is off 2 hours from the time returned by php date(); or any other php date/time function. It happens because server time set to EST and PHP.INI date.timezone="America/Denver"

I need to synchronize those two, by using date_default_timezone_set, but I don't know in advance what is the difference.

Is there any other way to get local server time besides calling exec?

UPD: I know that php.ini setting is wrong and that I can change it. The problem is that this script will work on nobody knows what kind of servers. I can't go to each and every one of them and correct the php.ini file. I also don't know in advance what timezone will be on those servers. I need a dynamic solution that will work everywhere.

you can change the ini date time zone and print the date

ini_set('date.timezone', 'America/Los_Angeles');