[PHP] How to Config PHP to run snmp in php script?

2002-02-20 Thread Raymond Mak

Dear All,
I am using RedHat Linux 7.2, PHP4.1 and its buitd-in apache, I had tested that 
the php run correctly with apache.

According to the documentation of www.php.net, As shown below:

#
XCIII. SNMP functions
In order to use the SNMP functions on Unix you need to install the UCD SNMP package. 
On Windows these functions are only available on NT and not on Win95/98.

Important: In order to use the UCD SNMP package, you need to define 
NO_ZEROLENGTH_COMMUNITY to 1 before compiling it. After configuring UCD SNMP, edit 
config.h and search for NO_ZEROLENGTH_COMMUNITY. Uncomment the #define line. It should 
look like this afterwards:

#define NO_ZEROLENGTH_COMMUNITY 1
 


If you see strange segmentation faults in combination with SNMP commands, you did not 
follow the above instructions. If you do not want to recompile UCD SNMP, you can 
compile PHP with the --enable-ucd-snmp-hack switch which will work around the 
misfeature.


I had successfully complie PHP with the --enable-ucd-snmp-hack switch but I 
can not find the file called config.h to edit. 
Finally, My question is 
WHERE is the file?? and IS THERE any points/steps need to look at in order to 
configure PHP to run snmp in PHP script?? 
Thx All.


RE: [PHP] How to Config PHP to run snmp in php script?

2002-02-20 Thread Hunter, Ray

Raymond,

Here is the break down:

1. Download ucd-snmp tar.gz file.
2. Download openssl tar.gz file.

You will need openssl for snmp v3 for the security stuff.

Uninstall ucd-snmp if it is installed on your system.  Uninstall openssl on
your system.  
3. Untar the files...
4. In the ucd-snmp directory find the file config.h and locate the
NO_ZEROLENGTH_COMMUNITY and uncomment the line if commented and set to 1.
5. Configure, make, make install the ucd-snmp
6. Configure, make, make install the openssl

***NOTE: Do a make clean in the php directory.  Then remove the
config.cache file from the php directory.***

7. Configure php with snmp
Example:
./configure --prefix=/usr/local/php --with-snmp=/usr/local/snmp
--with-openssl=/usr/local/openssl  --with-apxs=/usr/bin/apxs
make 
make install

This should work for you.

***NOTE: THINGS I HAVE TRIED***
1. I have tried to compile php with the openssl and snmp rpms.  However, php
chokes on the openssl rpm.  
2. If you want to try it with your already installed rpms, here is the
configuration that I have tried.

./configure --prefix=/usr/local/php --bindir=/usr/bin --sbindir=/usr/sbin
--libexecdir=/usr/lib --oldincludedir=/usr/include
--with-config-file-path=/etc --with-apxs=/usr/sbin/apxs --with-pear
--enable-sigchild --enable-magic-qoutes --enable-libgcc --enable-bcmath
--enable-calendar --enable-ctype --enable-dbx --enable-ftp
--enable-gd-native-ttf --enable-trans-sid --enable-shmop
--enable-ucd-snmp-hack --enable-sockets --enable-wddx --enable-yp
--enable-inline-optimization --with-xml --disable-debug --enable-pic
--enable-shared --with-regex=system --with-gettext --with-gd
--with-jpeg-dir=/usr --with-zlib --enable-safe-mode --enable-sysvsem
--enable-sysvshm --enable-debugger --with-gdbm --with-db2 --with-db3
--with-png --with-openssl=/usr/include/openssl

The problem that I faced here is that php chokes on finding the evp.h header
file in the openssl direcory.  I look in the directory and it is there.


Let me know if I can help you further.


Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: Raymond Mak [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, February 20, 2002 3:24 AM
To: [EMAIL PROTECTED]
Subject: [PHP] How to Config PHP to run snmp in php script?


Dear All,
I am using RedHat Linux 7.2, PHP4.1 and its buitd-in apache, I had
tested that the php run correctly with apache.

According to the documentation of www.php.net, As shown below:

#
XCIII. SNMP functions
In order to use the SNMP functions on Unix you need to install the UCD SNMP
package. On Windows these functions are only available on NT and not on
Win95/98.

Important: In order to use the UCD SNMP package, you need to define
NO_ZEROLENGTH_COMMUNITY to 1 before compiling it. After configuring UCD
SNMP, edit config.h and search for NO_ZEROLENGTH_COMMUNITY. Uncomment the
#define line. It should look like this afterwards:

#define NO_ZEROLENGTH_COMMUNITY 1
 


If you see strange segmentation faults in combination with SNMP commands,
you did not follow the above instructions. If you do not want to recompile
UCD SNMP, you can compile PHP with the --enable-ucd-snmp-hack switch which
will work around the misfeature.


I had successfully complie PHP with the --enable-ucd-snmp-hack
switch but I can not find the file called config.h to edit. 
Finally, My question is 
WHERE is the file?? and IS THERE any points/steps need to look at in
order to configure PHP to run snmp in PHP script?? 
Thx All.