|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38613 SNMP issues via Apache but ok via PHP CLI
Submitted: 2006-08-27 02:26 UTC Modified: 2007-04-10 01:00 UTC
Avg. Score:4.0 ± 0.8
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: neil at fissure dot net Assigned:
Status: No Feedback Package: SNMP related
PHP Version: 5.1.5 OS: CentOS release 4.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: neil at fissure dot net
New email:
PHP Version: OS:


 [2006-08-27 02:26 UTC] neil at fissure dot net
Similar to bug:

PHP gives errors when used as an Apache Module, but the 
same source code works via PHP CLI

Reproduce code:

$host = "xxx";
$community = "xxx";

$syscontact = snmpget($host, $community, "system.sysName.0");

PRINT "<BR>$syscontact\n";

Expected result:
<BR>STRING: 7200

Actual result:
Warning: snmpget() [function.snmpget]: Could not open 
snmp connection: Unknown host in /usr/local/apache/
htdocs/xxx/snmpwalk.php3 on line 9

I'm running:
PHP Version 5.1.6
'./configure' '--with-mysql' '--with-mysqli' '--enable-
mbstring' '--with-zlib-dir=/usr' '--with-curl' '--with-
snmp' '--with-apache=../apache_1.3.37' '--enable-ucd-

('--enable-ucd-snmp-hack' was added in troubleshooting)

Name   : net-snmp
Arch   : i386
Version: 5.1.2
Release: 11.EL4.6

Once, but only once stracing the httpd process, I saw:
write(2, "No support for requested transpo"..., 48) = 48
which I believe came from net-snmp


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-28 06:22 UTC]
Why do you think it's a PHP issue?

 [2006-08-30 16:56 UTC] neil at fissure dot net
I figured it was a PHP issue as it matched a similar bug 
report which was acknowledged to be due to a code change 
in PHP.

In that bug, sniper AT, who make the change, 
said they were using Apache 2 (and would test with 
Apache 1.x if they got a chance). So I'm figuring this 
issue lies with PHP and Apache 1.x

I'm happy to do any requested testing/diagnostics if you 
can give me some pointers.

I'm getting the same errors as in bug 32680 (which was 
acknowledged to be a PHP issue, not say an Apache 

Thanks for your time, Neil.
 [2006-08-30 17:52 UTC] neil at fissure dot net
Commenting out this line, in the 
PHP_MSHUTDOWN_FUNCTION(snmp) function of:

diff snmp.c snmp.c.orig 
< /*    snmp_shutdown("snmpapp"); */
>       snmp_shutdown("snmpapp");

but possibly at the risk of re-introducing the memory 
leak it was added to combat?
 [2007-04-02 22:07 UTC]
Please try using this CVS snapshot:
For Windows:

 [2007-04-10 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-07-29 09:57 UTC] cinek at xo dot pl
This bug is still in PHP 5.2.6 

Works perfectly with commented line, in the 
PHP_MSHUTDOWN_FUNCTION(snmp) function of:
 [2009-09-26 00:28 UTC] adam-phpbugs at adam dot gs
This bug is still in PHP-5.2.9 and PHP-5.3.0.

I can confirm that disabling snmp_shutdown() in 
PHP_MSHUTDOWN_FUNCTION(snmp) corrects the issue with no apparent side 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 03:01:28 2024 UTC