Connection to Cacti database failed

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
jscarville
Posts: 2
Joined: Fri May 31, 2019 9:25 pm

Connection to Cacti database failed

Post by jscarville »

This seems to be a popular error.

OS: CentOS 7.6.1810
DB: 5.5.60 (mariadb)
PHP: 5.4.16

I followed the instructions at https://www.cacti.net/downloads/docs/html/ but, when I reach the part about trying it in a browser I get:

Code: Select all

FATAL: Connection to Cacti database failed. Please ensure:
    the PHP MySQL module is installed and enabled.
    the database is running.
    the credentials in config.php are valid.
Each time I try I get a *lot* of errors, like this in the apache error_log:

Code: Select all

PHP Warning:  date(): 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 /usr/share/cacti/include/global_constants.php on line 28
I stepped through every last file mentioned in the error message looking for date.timezone but it does not seem to be where PHP thinks it is.

I did set date.timezone in /etc/php.ini:

Code: Select all

date.timezone = "America/Los_Angeles"
These are the settings in /usr/share/cacti/include/config.php

Code: Select all

$database_type     = 'mysql';
$database_default  = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cacti';
$database_password = '<password>';
$database_port     = '3306';
$database_retries  = 5;
$database_ssl      = false;
$database_ssl_key  = '';
$database_ssl_cert = '';
$database_ssl_ca   = '';
I have double-checked my work and it all looks correct. Obviously I am wrong but I don't see where the errors are. Any suggestions?

--
Stephen
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Connection to Cacti database failed

Post by cigamit »

Cacti version?
Is MySQL running, and can you login from the command line with the credentials you inputted into config.php?
What PHP modules are installed? (php -m)
For the timezone error, if using apache, did you restart apache after changing php.ini?
jscarville
Posts: 2
Joined: Fri May 31, 2019 9:25 pm

Re: Connection to Cacti database failed

Post by jscarville »

I tinkered with some PHP and MySQL setting this weekend and, somewhere along the line, it stared working. Some other stuff I need to track down and fix before I can start using Cacti but the database connectivity error seems to be fixed. To answer your questions:
cigamit wrote:Cacti version?
1.2.3
Is MySQL running, and can you login from the command line with the credentials you inputted into config.php?
Yes and yes,
What PHP modules are installed? (php -m)

Code: Select all

[PHP Modules]
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imap
intl
json
ldap
libxml
mbstring
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
snmp
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]
For the timezone error, if using apache, did you restart apache after changing php.ini?
Yes

--
Stephen
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest