|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-01-29 00:24 UTC] pookey@php.net
Description:
------------
despite PHP and snmpwalk sharing the same library, they
return different results for a query....
# ldd /usr/bin/snmpwalk | grep snmp
libnetsnmp.so.5 => /usr/lib/libnetsnmp.so.5
(0xb7ee6000)
# ldd /usr/bin/php | grep snmp
libnetsnmp.so.5 => /usr/lib/libnetsnmp.so.5
(0xb7616000)
Bug #29998 covers this, but was dismissed - I am left
wondering how despite using the same library, results
differ. According to the documentation, using the
SNMP_VALUE_PLAIN should prevent the displayed behaviour.
Sorry if I'm missing something.
Reproduce code:
---------------
# cat ./test.php
<?php
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
echo snmpget('reboot1', 'public', '.1.3.6.1.2.1.2.2.1.6.1') . "\n";
Expected result:
----------------
# snmpwalk -v 1 -c public
reboot2 .1.3.6.1.2.1.2.2.1.6.1
IF-MIB::ifPhysAddress.1 = STRING: 0:c0:b7:6a:c4:96
Actual result:
--------------
# php ./test.php
??jG
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
seems perl also works as expected... # cat ./test.pl #!/usr/bin/perl use Net::SNMP; use strict; my ($session, $error); ( $session, $error ) = Net::SNMP->session( -hostname => 'reboot1', -community => 'public', -timeout => 5, -port => 161, -localaddr => '192.168.0.1', -version => 1, ); print $error; my $result = $session->get_request('.1.3.6.1.2.1.2.2.1.6.1'); print $result->{'.1.3.6.1.2.1.2.2.1.6.1'}; print "\n"; # ./test.pl 0x00c0b76a8747