snmpset not working in php 4.0
| From: | bill at billsnet dot com | Date: | Mon, 12 Jun 2000 14:29:15 +0000 |
| Subject: | snmpset not working in php 4.0 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-1620@lists.php.net to get a copy of this message | ||
I am having problems with snmpset in php 4.0 and UCD-snmp version: 3.6.1 on solaris 2.7
I can set the system.sysContact.0 mib var by hand with ucd's snmpset
# snmpset 1.1.1.1 community .1.3.6.1.2.1.1.4.0 s "Sysconfig test"
system.sysContact.0 = "Sysconfig test"
Below is my php code, it's very simple. It poll the router's system.sysContact.0 then sets
the router's system.sysContact.0 and poll the router's system.sysContact.0 again.
<?
PRINT "\n";
$ip = "1.1.1.1";
$oid = ".1.3.6.1.2.1.1.4.0";
$community = "community";
$get = snmpget($ip, $community, $oid);
PRINT "snmpget $oid returned: $get\n";
$set = snmpset($ip, $community, ".1.3.6.1.2.1.1.4.0", "s", "PHP
updated");
PRINT "snmpset returned: $set\n";
$get = snmpget($ip, $community, $oid);
PRINT "snmpget $oid returned: $get\n";
?>
The output I get is:
X-Powered-By: PHP/4.0.0
Content-type: text/html
snmpget .1.3.6.1.2.1.1.4.0 returned: "Sysconfig test"
<br>
<b>Warning</b>: No Response from 1.1.1.1
in <b>php</b> on line <b>11</b><br>
snmpset returned:
snmpget .1.3.6.1.2.1.1.4.0 returned: "Sysconfig test"
snmp.c(235) : Freeing 0x00153718 (48 bytes), script=php
zend_API.c(189) : Actual location (location was relayed)
zend_hash.c(185) : Freeing 0x001492A8 (20 bytes), script=php
Has anyone used snmpset successful in php 4.0?