Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Thu May 25, 2017 1:43 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Trying to access Cacti's web page results in a PHP error.
PostPosted: Tue Apr 25, 2017 9:23 am 
Offline

Joined: Tue Apr 25, 2017 9:06 am
Posts: 4
I'm putting this in General, because I can't be sure the issue is caused by me using Linux. The computer running with Cacti on it is the following:
Code:
Linux cacti-server 4.10.10-200.fc25.x86_64 #1 SMP Thu Apr 13 01:11:51 UTC 2017 x86_64 GNU/Linux

It's using Arch's repos, but Fedora's kernel.

Specific error:
Code:
[Tue Apr 25 14:05:01.853727 2017] [proxy_fcgi:error] [pid 25790] [client 192.168.5.5:33550] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Undefined class constant 'MYSQL_ATTR_FOUND_ROWS' in /usr/share/webapps/cacti/lib/database.php:52
Stack trace:
#0 /usr/share/webapps/cacti/include/global.php(207): db_connect_real('192.168.5.200', 'cacti_user', 'Cacti_Pass', 'cacti_DB', 'mysql', '3306', false)
#1 /usr/share/webapps/cacti/include/auth.php(27): include('/usr/share/weba...')
#2 /usr/share/webapps/cacti/index.php(25): include('/usr/share/weba...')
#3 {main}
thrown in /usr/share/webapps/cacti/lib/database.php on line 52'

This is when going to hostname.com/cacti on a machine running a LAP configuration. Specifically, Linux, Apache, and PHP. I have a MariaDB MySQL server running on another machine on the LAN.

This same host is running PHPMyAdmin, and other web services which are working fine. PHPMyAdmin can connect to the MariaDB database as well.

Special things to consider:
    1. I've configured the config file under /etc/webapps/cacti/config.php for the remote server as well as the MySQL database (i.e. added user, gave privileges, etc). Because of this, I haven't installed mariadb on the server hosting cacti.
    2. The list of dependencies for cacti on Arch basically require installing Wayland and Mesa (display server and driver) for cairo. Specifically, it goes: rrdtool < pango < cairo < libgl < mesa < wayland. Where < means "depends on". I've opted to not do this and just copy the libGL.so file to the correct place, and install pango and rrdtool. I *could* be missing a symlink somewhere, but this is probably 100% unrelated to this issue.

While I've done stuff that's off the beaten path, I don't understand why any of it would make PHP throw an error when accessing a MySQL database because of an "Undefined class constant 'MYSQL_ATTR_FOUND_ROWS'".

Any help is appreciated.


Top
 Profile  
 
 Post subject: Re: Trying to access Cacti's web page results in a PHP error
PostPosted: Thu Apr 27, 2017 8:24 am 
Offline

Joined: Tue Apr 25, 2017 9:06 am
Posts: 4
Is this just an odd error that no one has any idea on, or did I do something that should obviously break it that isn't obvious to me?


Top
 Profile  
 
 Post subject: Re: Trying to access Cacti's web page results in a PHP error
PostPosted: Fri Apr 28, 2017 5:40 pm 
Offline
Developer

Joined: Thu Apr 07, 2005 3:29 pm
Posts: 2534
Location: B/CS Texas
That generally means that you don't have php-pdo or php-mysql installed.

_________________
CactiEZ CD


Top
 Profile  
 
 Post subject: Re: Trying to access Cacti's web page results in a PHP error
PostPosted: Mon May 01, 2017 8:37 am 
Offline

Joined: Tue Apr 25, 2017 9:06 am
Posts: 4
cigamit wrote:
That generally means that you don't have php-pdo or php-mysql installed.

That's what I had thought, however:
Code:
[root@httpd ~]# grep -i pdo_mysql.so database.txt
/usr/lib/php/modules/pdo_mysql.so
[root@httpd ~]# cat /etc/php/php.ini | grep pdo_mysql.so
extension=pdo_mysql.so
[root@httpd ~]# grep -i mysqli.so database.txt
/usr/lib/php/modules/mysqli.so
[root@httpd ~]# cat /etc/php/php.ini | grep mysqli.so
extension=mysqli.so

Note that database.txt is just "find / > ~/database.txt" (so a listing of every file on my system). So I have the extension, it's uncommented in the php.ini file, and said extension is working fine for other web services such as PHPMyAdmin.

Checking "/srv/http/index.php" on the system attempting to run Cacti, which contains nothing but:
Quote:
<?php phpinfo(); ?>

And it shows the following for mysqli:
Code:
mysqli

MysqlI Support   enabled
Client API library version   mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $
Active Persistent Links   0
Inactive Persistent Links   0
Active Links   0
Directive   Local Value   Master Value
mysqli.allow_local_infile   On   On
mysqli.allow_persistent   On   On
mysqli.default_host   no value   no value
mysqli.default_port   3306   3306
mysqli.default_pw   no value   no value
mysqli.default_socket   /run/mysqld/mysqld.sock   /run/mysqld/mysqld.sock
mysqli.default_user   no value   no value
mysqli.max_links   Unlimited   Unlimited
mysqli.max_persistent   Unlimited   Unlimited
mysqli.reconnect   Off   Off
mysqli.rollback_on_cached_plink   Off   Off

The PDO section shows the following:
Code:
PDO

PDO support   enabled
PDO drivers   no value

That's strange. Checking the configure command options for PHP on that page shows:
Code:
'--with-pdo-dblib=shared,/usr' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-pgsql=shared' '--with-pdo-sqlite=shared,/usr'

Could this be caused by not having a MySQL service installed on the same machine as PHP? Again, I'd find that weird since I would think all that's needed to access a remote MySQL database is a driver for MySQL, and since it's working for PHPMyAdmin I wouldn't expect that to be the problem, but I've experienced weirder things.

Note: This is PHP Version 7.1.4.


Top
 Profile  
 
 Post subject: Re: Trying to access Cacti's web page results in a PHP error
PostPosted: Mon May 08, 2017 12:03 pm 
Offline

Joined: Tue Apr 25, 2017 9:06 am
Posts: 4
Reinstalling from scratch fixed this issue but caused another which I resolved later.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Bing [Bot], Exabot [Bot], Google [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group