Fixing cacti php timezone installation error

Hello everyone !

When installing  some of the new versions of cacti you may come across these below 2 PHP errors related to a timezone which will prevent you from installation CACTI

This is a simple fix that involves editing the php.ini for PHP and php.ini file for PHP CLI

cacti installation screen

 

the PHP.ini files are located in these 3 directories on a Debian based system

 

/etc/php/7.0/fpm/php.ini
/etc/php/7.0/cli/php.ini
/etc/php/7.0/apache2/php.ini

 

if you are having a hard time finding your php.ini files run the following command to search for them

find / -name php.ini

 

Now once you have located the files we need to add the timezone to them to fix this error

see the below example on the php.ini file for apache

[email protected]:~# cat /etc/php/7.0/apache2/php.ini | grep timezone
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =
[email protected]:~#

 

we will need to uncomment the date.timezone directive and add our timezone in my case it’s America/Toronto

you can find a list of all supported PHP timezones here http://php.net/manual/en/timezones.php

using your choice of text editor edit /etc/php/7.0/apache2/php.ini  to below
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = “America/Toronto”

After you finish editing the file you must restart the apache process either by ( service apache2 restart) or on systemd systems ( systemctl apache2 restart)

[email protected]:~# service apache2 restart
[email protected]:~# service apache2 status
● apache2.service – LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf

Now let’s check the installer  to see if the error has cleared

cacti installtion screen

As you can see the error changed to Passed and the timezone matches what I set it to in php.ini

now all you have to do is the same steps for  /etc/php/7.0/cli/php.ini

 

Hope this helps!

 

 

 

 

 

 

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

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