Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 201586

Summary: www-servers/apache - mod_{dir,mime} support should be mandatory and not a USE flag
Product: Gentoo Linux Reporter: reillyp
Component: [OLD] ServerAssignee: Apache Team - Bugzilla Reports <apache-bugs>
Status: RESOLVED WONTFIX    
Severity: minor CC: php-bugs
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description reillyp 2007-12-07 14:06:30 UTC
Line 18 of the current version of /etc/apache2/modules.d/70_mod_php5.conf contains a gentoo-patched directive called AddDirectoryIndex. This directive needs to be wrapped with a <IfModule mod_dir.c>...</IfModule> or apache reports errors for those not loading the mod_dir module.

Reproducible: Always

Steps to Reproduce:
1. Comment out line 295 of current /etc/apache2/httpd.conf "LoadModule dir_module modules/mod_dir.so
2. Run "/etc/init.d/apache2 configtest" as root - reports error in the php module.
3.

Actual Results:  
The apache init script's configtest reports an unknown directive AddDirectoryIndex in the php5 module.

Expected Results:  
No close coupling between the php5 module and other non-required modules.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-12-07 14:10:18 UTC
Sigh. That module simply should NOT be optional or mod_php and lots of other apache modules become no-op, end of story. :/

Comment 2 Jakub Moc (RETIRED) gentoo-dev 2007-12-07 14:21:15 UTC
Hollow - if you don't want to make this mandatory, WONTFIX this bug. 

PHP is not going to check for mod_dir for AddDirectoryIndex directive, it doesn't work properly without it and as such the error is intended. We have enough users asking about on IRC why apache lets them download PHP files instead of parsing them already (which boils down to either failure to restart apache or browser cache/proxy in the way). This would add yet another hard to debug breakage.
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2007-12-07 15:06:15 UTC
BTW, ditto for mod_mime. Don't complain to PHP folks if you disable it and things break.
Comment 4 Benedikt Böhm (RETIRED) gentoo-dev 2007-12-07 15:43:06 UTC
well, there is a reason it is in the default selection, but i will not remove, because it might be useful for people building small, static apaches where mod_dir might not be necessary. (the same is true for mod_authz_host btw)
Comment 5 reillyp 2007-12-08 02:11:46 UTC
Uh - we talking about the same mod_dir? I added the IfModule wrapper to 70_mod_php5.conf and commented out the LoadModule dir_module line in httpd.conf and PHP appears to run fine. As far as I have always known (and I DO make my living with web apps and configuring apache) mod_dir just does some behind-the-scenes rewrites for you (not counting actually generating directory listing markup). And for security reasons I don't even want the possibility of apache automatically generating directory listings.

However, I will just leave my own changes in and have to merge any future updates to 70_mod_php5.conf. I always have to comment out massive quantities of LoadModules in httpd.conf itself anyway since the default config completely misses the whole security concept of "only enable what is needed"..
Comment 6 Jakub Moc (RETIRED) gentoo-dev 2007-12-08 08:41:01 UTC
(In reply to comment #5)
> Uh - we talking about the same mod_dir? 

Unless there's another mod_dir which I've missed, then yeah :) http://httpd.apache.org/docs/2.2/mod/mod_dir.html

> I added the IfModule wrapper to 70_mod_php5.conf and commented out the 
> LoadModule dir_module line in httpd.conf and PHP appears to run fine.

Except that index.php won't be added to DirectoryIndex, which is kinda what most webapps expect. ;)

> I always have to comment out massive quantities of
> LoadModules in httpd.conf itself anyway since the default config completely
> misses the whole security concept of "only enable what is needed"..

Well, our default configuration mostly matches upstream, as far as enabled modules are concerned (except for mod_auth_digest which was causing immense trouble due to lack of entropy). So if you think this should be handled differently, you should talk to upstream folks about it.
Comment 7 Benedikt Böhm (RETIRED) gentoo-dev 2007-12-08 09:10:46 UTC
(In reply to comment #5)
> However, I will just leave my own changes in and have to merge any future
> updates to 70_mod_php5.conf. I always have to comment out massive quantities of
> LoadModules in httpd.conf itself anyway since the default config completely
> misses the whole security concept of "only enable what is needed"..

The apache-2.2.x ebuilds automatically generate the load module lines for built-in modules, so maybe you should etc-update after upgrading/changing APACHE2_MODULES
Comment 8 Benedikt Böhm (RETIRED) gentoo-dev 2007-12-15 14:32:23 UTC
i have added a warning for these critical modules to -r6