Php snmp function Error

Source: Internet
Author: User
Tip:
Fatal error: Call to undefined function snmpwalkoid () in E: \ proj \ PHP \ SNMP. php on line 2

Code:
<? PHP
$ A = snmpwalk ("127.0.0.1", "public ","");
Foreach ($ A as $ Val ){
Echo "$ Val <br> ";
}
?>

Solution:
1. install PHP and Its modules
A) decompress the package;
B) modify PHP. ini-Dist to PhP. ini;
2. Configuration File
A) modify the php. ini configuration file.
I. Modify extension_dir = c: \ PHP \ extensions
Ii. Delete the quotation marks (;) before the extended modules you need, for example:
Originally:
; Extension = php_snmp.dll
To:
Extension = php_snmp.dll
B) configure system environment variables (not required in this step)
I. Add c: \ PHP (PHP installation directory) to the environment variable path)
Ii. Add a variable, right-click my computer-properties-advanced-Environment Variable-system variable-New mibdirs = C: \ PHP \ mibs, and create phprc = c: \ PHP
Iii. Modify the registry (if not, create a new string value ):
HKEY_LOCAL_MACHINE → software → PHP → inifilepath
Value: C: \ PHP (PHP installation directory)

After all the work is done, restart.
Create a PHP file:
Code:
<? PHP
$ A = snmpwalk ("127.0.0.1", "public ","");
Foreach ($ A as $ Val ){
Echo "$ Val <br> ";
}
?>
You can see the effect.
------------------------------------------------------------
If any:
Warning: snmpwalk no response from 127.0.01

The SNMP configuration for Windows 2003 is required:
SNMP in Windows 2003 does not allow direct access by default. You need to configure some parameters.

Download net-snmpinstallation from http://www.net-snmp.org/download.html.

After installing SNMP, you can view the security options in the SNMP service of the Windows service.

Select the send Authentication Trap, add the public group, and read-only permission.

Select Accept SNMP Packets from these hosts and add the IP address of the SNMP browser.

For Linux, configure the snmpd. conf file:
# Vi/etc/snmp/snmpd. conf
Modify the snmpd. conf file
1. com2sec notconfiguser default public
Changed to com2sec notconfiguser 127.0.0.1 public
If you want to run the monitoring software on another machine (192.168.11.50) (the IP address of the local machine is 192.168.11.134), add the following:
Com2sec notconfiguser 192.168.11.50 public

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.