PHP – Set Timezone

I am still working on the Cisco AXP. =.=

My application needs PHP PEAR but whenever i try to install/upgrade the PEAR modules. i got the following error.

PHP Fatal error: strtotime(): Timezone database is corrupt – this should *never* happen! in /usr/share/pear/PEAR/Validate.php on line 489

It seems that timezone is not configured for PHP. Create the following php and see whether the web server can show the correct date time on browser.

time.php

<?php
        echo date("r");
?>

If the time cannot be shown, that means the php does not know the timezone of your system.Here are the steps to set the timezone in PHP.

1. Check the the available timezone at /usr/share/zoneinfo

 

2. Edit the php.ini and set the following attribute

  • date.timezone = “Asia/Hong_Kong”

3. Restart the web server and test the time.php again =)

 

Done =)

Advertisements

2 thoughts on “PHP – Set Timezone”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s