Jumat, 02 November 2018

How to solve php warning Unknown: It is not safe to rely on the system's timezone

  Tidak ada komentar
How to solve php warning Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone  
[root@localhost php-5.4.45]# cp php.ini-production /usr/local/php5/lib/php.ini
[root@localhost php-5.4.45]#
[root@localhost php-5.4.45]# service httpd restart
Shutting down httpd:                                       [  OK  ]
Starting httpd: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
                                                           [  OK  ]
[root@localhost php-5.4.45]# php -i | grep "Configuration"
Configuration File (php.ini) Path => /usr/local/php5/lib
Loaded Configuration File => /usr/local/php5/lib/php.ini
Configuration
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
[root@localhost php-5.4.45]#
Open the php.ini configuration file
[root@localhost php-5.4.45]# vi /usr/local/php5/lib/php.ini
[root@localhost php-5.4.45]#
Setup the date time zone with your time zone like following figure
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =
date.timezone = Asia/Jakarta
Restart the apache service again
[root@localhost php-5.4.45]# service httpd restart
Shutting down httpd:                                       [  OK  ]
Starting httpd: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
                                                           [  OK  ]
[root@localhost php-5.4.45]# php -i | grep "Configuration"
Configuration File (php.ini) Path => /usr/local/php5/lib
Loaded Configuration File => /usr/local/php5/lib/php.ini
Configuration
[root@localhost php-5.4.45]#

Tidak ada komentar :

Posting Komentar