Reputation: 23
I want to use snmp class on PHP, and try that example-1 on my server.
<?php
$session = new SNMP(SNMP::VERSION_1, "127.0.0.1", "public");
$sysdescr = $session->get("sysDescr.0");
echo "$sysdescr\n";
$sysdescr = $session->get(array("sysDescr.0"));
print_r($sysdescr);
?>
when I execute this I get this error:
PHP Fatal error: Class 'SNMP' not found in /var/www/wls/wtest.php on line 2
I installed snmp and php with yum:
yum install httpd php php-devel php-snmp net-snmp
I also tried to find cause but i found just about library and my server info:
php-5.3.3-14.el6_3.x86_64 php-snmp-5.3.3-14.el6_3.x86_64 net-snmp-5.5-41.el6_3.1.x86_64
I think the reason must be so simple but I couldn't found it, Thanks for your help.
Upvotes: 2
Views: 10916
Reputation: 46
The SNMP class is only available in PHP 5.4 and higher, for PHP 5.3 and lower and you have to use the SNMP functions instead, http://php.net/manual/en/ref.snmp.php.
Upvotes: 3
Reputation: 32272
php-snmp.so
is listed in extensions.ini
.phpinfo()
.Upvotes: 0