Cem Taylan Bozkurt
Cem Taylan Bozkurt

Reputation: 23

can not implement SNMP class in PHP

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

Answers (2)

Clint Nelissen
Clint Nelissen

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

Sammitch
Sammitch

Reputation: 32272

  1. Restart Apache.
  2. Check that php-snmp.so is listed in extensions.ini.
  3. Check if there's a section for php-snmp in phpinfo().
  4. Check your server's logs.

Upvotes: 0

Related Questions