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 =)

3 thoughts on “PHP – Set Timezone”

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.