php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12835 SNMP compiling bug
Submitted: 2001-08-19 05:51 UTC Modified: 2001-08-19 22:49 UTC
From: admin at networkessence dot net Assigned:
Status: Closed Package: SNMP related
PHP Version: 4.0.6 OS: linux 2.2.14 (rh6)
Private report: No CVE-ID: None
 [2001-08-19 05:51 UTC] admin at networkessence dot net
I believe there's a compilation problem with php and snmp.  I've tried many different ways to go about trying to get it to work, but no matter, I end up with the snmp functions being undefined.

for some reason, no matter what happens, the snmp_add_var, snmp_get_quick_print, and snmp_set_quick_print are undefined - this is if I compile it static.  If I compile snmp as shared, it's worse.

I have no idea what the problem is to tell you the truth, but I have not only tried many different things, but so have others, and I have found no solutions on the net.  It would be great if someone could get this to work.  If I find the solution I'll email it to someone.  But until then, maybe someone else can find it eaiser (and quicker) than I.

Below are the symbols lists.  The first is if snmp is compiled with php, and the second is if snmp is compiled as a shared module:

[root libs]# nm -D ./libphp4.so|grep snmp
000b1cc8 T php_if_snmp_get_quick_print
000b1cf8 T php_if_snmp_set_quick_print
000b1c38 T php_if_snmpget
000b1c98 T php_if_snmprealwalk
000b1df4 T php_if_snmpset
000b1c68 T php_if_snmpwalk
000b0d30 T php_info_snmp
000b0d10 T php_minit_snmp
000b0d84 T php_snmp
001f3a40 D snmpStats
0016c364 T snmp_add_null_var
         U snmp_add_var
0017415c T snmp_auth_build
001740d0 T snmp_auth_parse
00171b10 T snmp_build
00173d5c T snmp_build_var_op
00171a3c T snmp_close
001f3aa4 D snmp_dump_packet
001f3a28 D snmp_errno
0016c91c T snmp_errstring
0016c5d0 T snmp_fix_pdu
00172924 T snmp_free_pdu
001ee25c D snmp_functions
         U snmp_get_quick_print
001ee2c0 D snmp_module_entry
0016da6c T snmp_new_prefix
0017145c T snmp_open
00173cbc T snmp_parse_var_op
0016c2f0 T snmp_pdu_create
001729a0 T snmp_read
00172c34 T snmp_select_info
001725d0 T snmp_send
         U snmp_set_quick_print
0016c4d0 T snmp_synch_input
0016c774 T snmp_synch_response
0016c8e0 T snmp_synch_setup
00172da4 T snmp_timeout

[root httpd]# nm /home/install/php-4.0.6/modules/snmp.so|grep snmp
00002218 T php_if_snmp_get_quick_print
00002248 T php_if_snmp_set_quick_print
00002188 T php_if_snmpget
000021e8 T php_if_snmprealwalk
00002344 T php_if_snmpset
000021b8 T php_if_snmpwalk
0000128c T php_info_snmp
0000126c T php_minit_snmp
000012e0 T php_snmp
         U snmp_add_null_var
         U snmp_add_var
         U snmp_close
         U snmp_errstring
         U snmp_fix_pdu
         U snmp_free_pdu
0000361c D snmp_functions
         U snmp_get_quick_print
00003680 D snmp_module_entry
         U snmp_open
         U snmp_pdu_create
         U snmp_set_quick_print
         U snmp_synch_response
         U snmp_synch_setup

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-19 06:45 UTC] sniper@php.net
What version of ucd-snmp do you have?
How did you install / configure /compile it?
What was the configure line for PHP?

--Jani

 [2001-08-19 17:17 UTC] admin at networkessence dot net
ucd-snmp ver 4.2.1.

The configure line for ucd-snmp was ./configure --with-openssl=/home/install/openssl-0.9.6b
This was done so the proper files would be included for -lcrypto.

For php, i tried:
./configure --enable-ucd-snmp-hack --with-snmp=/home/install/ucd-snmp-4.2.1
./configure --enable-ucd-snmp-hack --with-snmp=shared,/home/install/ucd-snmp-4.2.1
./configure --enable-ucd-snmp-hack --with-snmp=shared

Performing make clean and rm ./config.cache between each configure/compile.

When compiling snmp into php (first one), snmp_add_var, snmp_get_quick_print, and snmp_set_quick_print are undefined (seen on prev post).  When compiling as shared, it was worse (seen on prev post).

With all three, if I try using an snmp function, they are all undefined:
./test.php
<? snmpget('host', 'community', 'system.SysContact.0'); ?>

result:
Fatal error: Call to undefined function: snmpget() in /path/to/test.php on line 1

And here is a little more info.  If I check symbols in snmp-0.4.2.1.so (after compiling ucd-snmp), 

[root .libs]# nm ./libsnmp-0.4.2.1.so|grep snmp|grep U
0001d8ec t snmpv3_scopedPDU_header_build
0001dc2c t snmpv3_scopedPDU_header_rbuild
00026a44 T snmpv3_scopedPDU_parse

And as can be seen below, the functions (snmp_add_var, snmp_get_quick_print, snmp_set_quick_print) in the ucd-snmp compiled .so are there:

[root .libs]# nm ./libsnmp-0.4.2.1.so|grep snmp_add
00009484 T snmp_add_null_var
000292f8 T snmp_add_var
[root .libs]# nm ./libsnmp-0.4.2.1.so|grep snmp_get_quick
0002a04c T snmp_get_quick_print

[root .libs]# nm ./libsnmp-0.4.2.1.so|grep snmp_set_quick
0002a024 T snmp_set_quick_print

This is my second attempt at this.  I waited till a couple versions of PHP came out to try it again, so I tried this about 6 months ago (i think) with snmp vers 4.2 and had pretty much the same troubles.
 [2001-08-19 20:34 UTC] sniper@php.net
Try this configure line:

./configure --with-snmp=/usr/local --with-openssl=/home/install/openssl-0.9.6b

If you didn't give --prefix for SNMP configure,
it will install the in /usr/local

If you did give the prefix, use the same in PHP configure
in --with-snmp option. 

And have you added the necessary lines into /etc/ld.so.conf?
If you put stuff elsewhere than default paths, you ALWAYS
have to tell where the libs are. Remember to run /sbin/ldconfig too


--Jani

 [2001-08-19 22:49 UTC] admin at networkessence dot net
./configure --with-snmp=/usr/local --with-openssl=/usr/src/openssl-0.9.6b didn't work, BUT

./configure --with-snmp=/usr/local --with-openssl (no dir specified) worked!

Specifying a directory for --with-openssl= seems to break -lcrypto.

It is now working.

So it looks like the steps are
compile snmp
./configure --with-openssl=/path/to/openssl-vers
make | make install
then compile php as such:
./configure --with-snmp=/usr/local --with-openssl --enable-ucd-snmp-hack

Thanks for the help!  I will post note on manual of my experiences and hope I save someone the hassles I went through.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 00:01:29 2024 UTC