PHP errors when executing poller.php

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

Moderators: Developers, Moderators

Post Reply
daveyw
Posts: 5
Joined: Sat Apr 19, 2008 8:12 am
Location: Netherlands

PHP errors when executing poller.php

Post by daveyw »

Hello,

I installed the lastest Cacti today and Plugin Architecture (a few hours ago) and when i do "/usr/local/bin/php /usr/local/cacti/poller.php" i got errors.

Operation System: CentOS 4.6 Final - x86_64
PHP Version: PHP 5.2.5
MySQL Version: 5.0.41


The Errors
[root@xxxxx ~]# /usr/local/bin/php /usr/local/cacti/poller.php
PHP Warning: reset(): Passed variable is not an array or object in /usr/local/cacti/lib/functions.php on line 146

Warning: reset(): Passed variable is not an array or object in /usr/local/cacti/lib/functions.php on line 146
PHP Warning: Variable passed to each() is not an array or object in /usr/local/cacti/lib/functions.php on line 147

Warning: Variable passed to each() is not an array or object in /usr/local/cacti/lib/functions.php on line 147
PHP Warning: reset(): Passed variable is not an array or object in /usr/local/cacti/lib/functions.php on line 146

Warning: reset(): Passed variable is not an array or object in /usr/local/cacti/lib/functions.php on line 146
PHP Warning: Variable passed to each() is not an array or object in /usr/local/cacti/lib/functions.php on line 147

Warning: Variable passed to each() is not an array or object in /usr/local/cacti/lib/functions.php on line 147
Here are line 146 and 147 from the file /usr/local/cacti/lib/functions.php
Line 146: reset($settings);
Line 147: while (list($tab_name, $tab_array) = each($settings)) {
Can somebody help me out with this problem? I'll hope it can be fixed soon, because now my graphs doesn't work :roll:
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

You may want to use latest lib/functions.php from SVN. Or use this function code as a replacement (this is from an non-PIA functions.php)

Code: Select all

function read_default_config_option($config_name) {
	global $config, $settings;

	if (is_array($settings)) {
		reset($settings);
		while (list($tab_name, $tab_array) = each($settings)) {
			if ((isset($tab_array[$config_name])) && (isset($tab_array[$config_name]["default"]))) {
				return $tab_array[$config_name]["default"];
			}else{
				while (list($field_name, $field_array) = each($tab_array)) {
					if ((isset($field_array["items"])) && (isset($field_array["items"][$config_name])) && (isset($field_array["items"][$config_name]["default"]))) {
						return $field_array["items"][$config_name]["default"];
					}
				}
			}
		}
	}
}
Reinhard
daveyw
Posts: 5
Joined: Sat Apr 19, 2008 8:12 am
Location: Netherlands

Post by daveyw »

Thanks, this resolved the problem.

by the way: I used the tar.gz file from cacti.net. Maybe it's an good idea to edit that also in the tar.gz file?

Thank You
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Policy of the Cacti Group is to deliver patches to correct issues. This way, we won't get mixed up by different code having the same version info. This is mentioned in the manuals linked by the 3rd link of my sig
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest