php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32680 PHP_MSHUTDOWN PHP_MINIT
Submitted: 2005-04-12 10:18 UTC Modified: 2005-05-10 15:30 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: dejan at akton dot si Assigned: sniper (profile)
Status: Closed Package: SNMP related
PHP Version: 4CVS, 5CVS (2005-04-15) OS: *
Private report: No CVE-ID: None
 [2005-04-12 10:18 UTC] dejan at akton dot si
Description:
------------
In 4.3.11 someone added a PHP_MSHUTDOWN(snmp) to ext/snmp/snmp.c extension. I'm not so familiar with the PHP source it self, but here's what I see.
In CLI version, PHP_MINIT() and PHP_MSHUTDOWN works as expected, when script starts PHP_MINIT() is called which initialized the snmp API and when script is done, PHP_MSHUTDOWN is called, which clears the instance of snmp API. But under Apache there's a problem.
When apache starts, it calls PHP_MINIT() but it also calls PHP_MSHUTDOWN, which clears the instance. When you request a script via Apache, the PHP_MINIT() is not called and SNMP Api is not initialized and I receive strange errors. 

Reproduce code:
---------------
$foo = snmpget('127.0.0.1', 'public', 'system.SysContact.0');

Expected result:
----------------
Output from system.SysContect.0

Actual result:
--------------
Invalid OID and invalid host. From the SNMP API I receive: 
No support for requested transport domain "udp".
And this is because the API was not initialized and transport domains were not loaded!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-15 14:04 UTC] sniper@php.net
It was me who added the MSHUTDOWN() to get rid of the memleaks..fixing.

 [2005-04-23 23:31 UTC] sniper@php.net
I can not reproduce this. What apache version are you using?
What configure line did you use with PHP? 

 [2005-04-25 08:27 UTC] dejan at akton dot si
My configure line:
'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-zlib' '--enable-bcmath' '--enable-calendar' '--with-dom' '--with-dom-xslt' '--with-dom-exslt' '--enable-exif' '--enable-ftp' '--with-gd' '--with-t1lib' '--with-gettext' '--with-imap=/usr/include/imap' '--with-mysql=/usr/local' '--with-ncurses' '--enable-pcntl' '--with-readline' '--with-snmp=/usr/local' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-msdblib' '--enable-dbmfix' '--with-tdsver=7.0' '--with-freetds=/usr/local' '--with-mssql' '--with-openssl' '--with-ttf' '--with-freetype-dir=/usr/local' '--disable-ipv6' '--disable-debug' '--enable-dio' 

Apache Version: Apache/1.3.29 

I tried with two net-snmp versions, including the new one 5.2.1

PHP_MINIT should be called with every request to a PHP script via Apache? And PHP_MSHUTDOWN when script ends?
 [2005-04-25 23:57 UTC] sniper@php.net
Try this configure line:

# ./configure --disable-all --with-apxs=/usr/local/apache/bin/apxs --with-snmp=/usr/local

Using this snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz

 [2005-04-26 14:17 UTC] dejan at akton dot si
Same thing happened. Any clues as to what is causing this problem? Is this a specific problem only on my computer?
 [2005-04-29 01:10 UTC] sniper@php.net
I need to test this with Apache1 sometime, but atm I have no time. (I use Apache2 myself)

If you can, do try with Apache2 to see if the problem disappears.

 [2005-05-10 15:30 UTC] sniper@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 16:01:31 2024 UTC