#19135 [Fbk->Opn]: Can't execute snmp functions

From: Date: Thu, 29 Aug 2002 01:52:54 +0000
Subject: #19135 [Fbk->Opn]: Can't execute snmp functions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18107@lists.php.net to get a copy of this message
ID: 19135 User updated by: george.travan@adelaide.edu.au Reported By: george.travan@adelaide.edu.au -Status: Feedback +Status: Open Bug Type: SNMP related Operating System: solaris 2.6 PHP Version: 4.2.2 New Comment: The $workstations array does report correctly the ip's on closer inspection. echo "-{$workstations[$i]-"; correctly identifies the array members. just seems to fail as an argument to snmpget. Previous Comments: ------------------------------------------------------------------------ [2002-08-28 21:28:42] sniper@php.net Seems more like some bug in your script.. Are you sure $workstations[$i] holds the IP ? Try adding this before the snmpget() call: echo "-{$workstations[$i]-"; so you'll see that there aren't any extra stuff in it..like \n or so. Each line in that array returned by file will hold the line ending.. ------------------------------------------------------------------------ [2002-08-28 20:06:45] george.travan@adelaide.edu.au forgot to include that $number_of_workstations = count($workstations); seems to be a problem with $workstations[$i] in the loop causing this. ------------------------------------------------------------------------ [2002-08-28 20:02:40] george.travan@adelaide.edu.au I think I know what could be happening. snippet of code: $workstations = file ("workstations.txt"); for ($i=0; $i < $number_of_workstations; $i++) { $status = snmpget($workstations[$i], $community, ".1.3.6", $timeout, $retries); The problem is with $workstations[$i]. When I replace this with the workstation ip address it works. So it seems the problem is with the construction of the argument. ------------------------------------------------------------------------ [2002-08-28 12:35:09] kalowsky@php.net Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. Please post a sample script ------------------------------------------------------------------------ [2002-08-27 21:01:33] george.travan@adelaide.edu.au PHP Version 4.2.2 UCD-SNMP Version 4.2.1 Apache 1.3.2 OS Solaris 2.6 (with all current patches) I could configure and compile PHP with SNMP, however, when I try a simple snmpget retieval, the PHP error log reports that "Could not open snmp in /usr/local/apache/htdocs/snmptest.php line 10" Now the same command works on the command line. Anyone seen this behaviour? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19135&edit=1

« previous php.bugs (#18107) next »