Problem with poller.php

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

Moderators: Developers, Moderators

Post Reply
davyp74
Posts: 10
Joined: Tue Jul 11, 2006 8:49 am

Problem with poller.php

Post by davyp74 »

Hi, i've a problem when i run php poller.php from cacti user

-sh-2.05b$ php poller.php
sh: line 1: /php: No such file or directory
sh: line 1: /rrdtool: No such file or directory


help me please.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Confirm that the Settings for the paths to these executables are correctly set in the Cacti settings.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
davyp74
Posts: 10
Joined: Tue Jul 11, 2006 8:49 am

Post by davyp74 »

rony wrote:Confirm that the Settings for the paths to these executables are correctly set in the Cacti settings.
Cacti Setting:
PHP Binary Path = /usr/bin/php
RRDTool Binary Path = /usr/bin/rrdtool

Executable:
[root@]# which php
/usr/bin/php
[root@]# which rrdtool
/usr/bin/rrdtool

:(
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Run the which as the Cacti user.

Does the Cacti user have the abbility execute those files?
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
davyp74
Posts: 10
Joined: Tue Jul 11, 2006 8:49 am

Post by davyp74 »

rony wrote:Run the which as the Cacti user.

Does the Cacti user have the abbility execute those files?

[root@]# su - cacti
-sh-2.05b$ which php
/usr/bin/php
-sh-2.05b$ which rrdtool
/usr/bin/rrdtool
-sh-2.05b$ php test
Status: 404
X-Powered-By: PHP/4.4.2
Content-type: text/html

No input file specified.

-sh-2.05b$ rrdtool test
RRDtool 1.0.50 Copyright 1997-2004 by Tobias Oetiker <tobi@oetiker.ch>

Usage: rrdtool [options] command command_options

Valid commands: create, update, graph, dump, restore,
last, first, info, fetch, tune, resize, xport

RRDtool is distributed under the Terms of the GNU General
Public License Version 2. (www.gnu.org/copyleft/gpl.html)

For more information read the RRD manpages
davyp74
Posts: 10
Joined: Tue Jul 11, 2006 8:49 am

Post by davyp74 »

if i run (from cacti user):

php index.php

i see the code of index.php

I've installed this cacti-0.8.6h-1.1.fc2.rf and rrdtool-1.0.50-3.fc2.rf


tnx
davyp74
Posts: 10
Joined: Tue Jul 11, 2006 8:49 am

Post by davyp74 »

Hi, i'm debuging poller.php.
The error is on line 133:

exec_background($command_string, "$extra_args $first_host $last_host");

The command generated is:

/usr/bin/php -q /var/www/cacti/cmd.php 0 1

If i run this command from cacti user i get this error:

-sh-2.05b$ /usr/bin/php -q /var/www/cacti/cmd.php 0 1
->refusedsh: line 1: /perl: No such file or directory
sh: line 1: /perl: No such file or directory
sh: line 1: /perl: No such file or directory
sh: line 1: /perl: No such file or directory
sh: line 1: /perl: No such file or directory

But:
-sh-2.05b$ which perl
/usr/bin/perl


Can you help me?
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

What shell is cactiuser using?
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
davyp74
Posts: 10
Joined: Tue Jul 11, 2006 8:49 am

Post by davyp74 »

I stopped this activity because i've a big problem with my server.

Thank you for reply.
davyp74
Posts: 10
Joined: Tue Jul 11, 2006 8:49 am

Post by davyp74 »

rony wrote:What shell is cactiuser using?
I've tried all shell ... but it doesn't work!
Same problems!
realriot
Posts: 3
Joined: Fri Sep 01, 2006 6:04 am

Post by realriot »

Hi,

I've got the same problem.

- I just installed cacti with apt-get install cacti
- I use Ubuntu 6.06
- Everything works fine except the poller (Webinterface etc. are fine)
/usr/bin/php /usr/share/cacti/site/poller.php
sh: /php: No such file or directory
sh: /rrdtool: No such file or directory
The crontab exists within /etc/cron.d
cat /etc/cron.d/cacti
MAILTO=root
*/5 * * * * www-data /usr/share/cacti/site/poller.php >/dev/null 2>/var/log/cacti/poller-error.log
Someone has a hint for me what kind of problem it is?

Sascha
realriot
Posts: 3
Joined: Fri Sep 01, 2006 6:04 am

Post by realriot »

Ah, I've found a mistake.
Within /etc/php5/cli/ safe_mode was defined. So it couldn't change to the given path i think...

But isn't it a security risk to disable safe_mode for the cli?

Sascha
User avatar
rasolama
Posts: 4
Joined: Fri Jan 26, 2007 9:54 am

PHP Safe Mode Problem

Post by rasolama »

OK I've got teh same problem and have succefully fixt teh problem by disabling Safe Mode in php.ini - but this is pretty insecure no?

Again the error I'm getting is this:

sh: /rrdtool: No such file or directory

I was also getting the same error for /php but I fixed that by creating a .bash_profile and .bashrc for teh user 'catiuser' (something I'm also a little uncomfortable with - I usually use a /bin/nologin for users such as this...

Anyway the question I'm asking is - is there a a *safer* way to do this?

environment:

Madriva Linux 2006 rrdtool-1.2.15
jukay
Posts: 2
Joined: Tue Sep 28, 2004 8:43 am
Location: Sweden
Contact:

Post by jukay »

Here is the quick fix I'm using:

Open poller.php and change the first line to:

Code: Select all

#!/path/to/php -d safe_mode=off -q
Then scroll down to around line 99 and find the current block of code:

Code: Select all

        /* Determine Command Name */
        if ($poller == "2") {
                $command_string = read_config_option("path_cactid");
                $extra_args = "";
                $method = "cactid";
                chdir(dirname(read_config_option("path_cactid")));
        }else if ($config["cacti_server_os"] == "unix") {
                $command_string = read_config_option("path_php_binary");
                $extra_args = "-q " . $config["base_path"] . "/cmd.php";
                $method = "cmd.php";
        }else{
                $command_string = read_config_option("path_php_binary");
                $extra_args = "-q " . strtolower($config["base_path"] . "/cmd.php");
                $method = "cmd.php";
        }
Change

Code: Select all

$extra_args = "-q " . $config["base_path"] . "/cmd.php";

and

$extra_args = "-q " . strtolower($config["base_path"] . "/cmd.php");
To

Code: Select all

$extra_args = "-d safe_mode=off -q " . $config["base_path"] . "/cmd.php";

and

$extra_args = "-d safe_mode=off -q " . strtolower($config["base_path"] . "/cmd.php");
Not the best solution, but you don't have to disable safe_mode for your whole site this way.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest