error when running poller.php from the command line

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
jagbarcelo
Posts: 23
Joined: Mon Nov 21, 2005 4:28 am
Location: Spain

error when running poller.php from the command line

Post by jagbarcelo »

This is quite strange, since it is telling me to run it from the command line, which is exactly what I am doing!!! ;)

C:\cacti>c:\cacti\poller.php
Content-type: text/html
X-Powered-By: PHP/4.3.8

<br><strong>This script is only meant to run at the command line.</strong>
C:\cacti>php.exe c:\cacti\poller.php
Content-type: text/html
X-Powered-By: PHP/4.3.8

<br><strong>This script is only meant to run at the command line.</strong>
C:\cacti>

I am running it with the following configuration:
Windows 2003 Server
IIS 6.0 all SPs applied
php 4.3.8 (as shown in the errors)
cacti-0.8.6g
cacti-cactid-0.8.6f-1

Any ideas? I'm not updating my rrds because of this, please help.
rkramer
Cacti User
Posts: 54
Joined: Fri Jun 03, 2005 12:25 pm

Post by rkramer »

you need to run that as a parameter to php.exe, running it directly won't do much if windows isn't set up to process .php (it won't be unless you did it manually...)
jagbarcelo
Posts: 23
Joined: Mon Nov 21, 2005 4:28 am
Location: Spain

Post by jagbarcelo »

As you can see I have been doing 2 tests, one calling directly to poller.php (i have already set windows to start php.exe to run it) and another try with php.exe c:\cacti\poller.php. None of them works.

C:\cacti>c:\cacti\poller.php
Content-type: text/html
X-Powered-By: PHP/4.3.8

<br><strong>This script is only meant to run at the command line.</strong>
C:\cacti>php.exe c:\cacti\poller.php
Content-type: text/html
X-Powered-By: PHP/4.3.8

<br><strong>This script is only meant to run at the command line.</strong>
C:\cacti>

Any idea on the subject?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Possibly a user rights problem. I suggest you read the guide in my signature. Does it work under an admin account?
jagbarcelo
Posts: 23
Joined: Mon Nov 21, 2005 4:28 am
Location: Spain

Post by jagbarcelo »

Yes I'm using an admin account, so permissions should not be a problem. I have read the guide in your signature. There were some points that I had missed, such as:

8. Give the user who will be running the scheduled task, modify rights to:
If using PHP 4: c:\php\mibs\.index

but it still does not work. I still get the same error telling me to use the command line which is what I am doing.

Maybe the problem resides in the way Windows throws the execution of poller.php. I have had a look at the code in poller.php and found the following:

if (!isset($_SERVER["argv"][0])) {
die("<br><strong>This script is only meant to run at the command line.</strong>");
}

What is the meaning of the first line? I have commented the whole 3 lines and then tried again. The execution of poller.php continues and it runs another window called cactiplus in which cactid is ran. Is this the behaviour expected? Even though poller.php seems to throw the execution of cactid, the RRAs are not updated either. There must be an issue in the way Windows/PHP manage to communicate 'argv' variable.

Any ideas after this comments?
User avatar
TheWitness
Developer
Posts: 17061
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

It keeps people from spawning your poller process from the web server. Please verify that safe mode if off. Also, make sure the following is set in your PHP.INI file "register_argc_argv = On"

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
jagbarcelo
Posts: 23
Joined: Mon Nov 21, 2005 4:28 am
Location: Spain

Post by jagbarcelo »

Yes, you were right. I had my php.ini set as
register_argc_argv = Off

I have just changed it to 'On' and it seems to work now. Calling poller.php updates my RRAs, but not all of them. I'll have a look at the error messages more deeply and try to solve the issues myself before posting anything else ;)

Thanks a lot for your help, and good work.
websat
Cacti User
Posts: 70
Joined: Wed Jun 22, 2005 3:00 pm
Contact:

Post by websat »

hi
i also have thiss error:

C:\wwwroot>cacti.cmd

C:\wwwroot>C:\php\php.exe C:\wwwroot\cacti\poller.php
X-Powered-By: PHP/4.4.1
Content-type: text/html

<br><strong>This script is only meant to run at the command line.</strong>
C:\wwwroot>

Register Argc Argv: on
PHP Safe mode: on

thanks if someone can help...
Visit my web site: http://www.websat-telecom.com
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

And did you follow the same advice we gave jagbarcelo?
User avatar
TheWitness
Developer
Posts: 17061
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Please edit include/config.php, then goto line 137 or so. You will see an array that contains things like "poller.php", "cmd.php", etc. Please add "script_server.php", "ss_fping.php" to that list, save and then retry. Please post your results.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
michlch
Posts: 4
Joined: Fri Oct 28, 2011 2:20 am

Re: error when running poller.php from the command line

Post by michlch »

Hi, I have the same problem here. I am using the latest Cacti verstion 0.8.7h.

I have check and make sure that my php.ini has these:
register_argc_argv = On
safe_mode = Off

But, I still get the same error.
I checked the include/config.php. There are no line 137, no section where it has cmd.php/poller.php.

Can anybody help?

Thanks in advance.
User avatar
TheWitness
Developer
Posts: 17061
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: error when running poller.php from the command line

Post by TheWitness »

Please post a fresh post. This one is a bit old. In that post, please include screen shot's of what you are attempting to describe.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest