ID: 45883 User updated by: richrumble at gmail dot com Reported By: richrumble at gmail dot com -Status: Feedback +Status: Open Bug Type: SNMP related Operating System: Windows PHP Version: 5.2.6 New Comment:
I got it working with a new download and install, I think a wamp php.ini file was being used, very strange nonetheless that it worked via the browser calling the php vs the cli... Thanks for your time. Previous Comments: ------------------------------------------------------------------------ [2008-08-21 17:35:17] [EMAIL PROTECTED] It does not make sense. Double check that the php.ini is correctly loaded and that you use the right extension_dir. php.exe -i > info.txt and then open info.txt in your editor. ------------------------------------------------------------------------ [2008-08-21 17:28:20] richrumble at gmail dot com I've tried specifying the php.ini via the -c argument C:\php>php.exe -c c:\php\php.ini snmptest.php I've copied the php.ini file to c:\windows\ SNMP is enabled when I call phpinfo via the browser, but does not show enabled when called via CLI. It's easy to reproduce on any windows system. There appear to be no additional steps to install php-snmp extension, uncomment in php.ini, and snmpwalk works via browser, but fails via cli. -rich ------------------------------------------------------------------------ [2008-08-21 16:30:57] [EMAIL PROTECTED] which php.ini is used by your webserver and which is used by cli? Do you get any error while running cli (cannot find dll xyz, etc)? Have you installed the required files and data as described in the manual? ------------------------------------------------------------------------ [2008-08-21 16:22:23] richrumble at gmail dot com Description: ------------ Technically phpinfo() can show you part of the problem With SNMP enabled, running that script from the browser will show you snmp enabled, running the phpinfo script from cli shows it's not enabled, but every other function is! Any simple snmp command will result in the following error: Fatal error: Call to undefined function snmprealwalk() substitute snmprealwalk with any snmp function Reproduce code: --------------- <?php phpinfo(); ?> or <?php $host = "localhost"; $community = "public"; $oid = ".1.3.6.1.2.1.2.2.1.2"; $arr = snmpwalk($host, $community, $oid); print_r($arr); ?> Expected result: ---------------- PhpInfo(cli) that matches phpinfo from browser SNMP results from host. Actual result: -------------- SNMP Extension missing from phpinfo when called via command line interface ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45883&edit=1