Module loaded(if statement)?

Discussion in 'Apache' started by JMaste, Aug 11, 2010.

  1. #1
    Hi,

    How can I check using IF statements if the module is present before applying the configuration rule or before installing it?

    Thanks.
     
    JMaste, Aug 11, 2010 IP
  2. tolra

    tolra Active Member

    Messages:
    515
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    80
    #2
    tolra, Aug 11, 2010 IP
  3. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #3
    Be careful. Just because a module is loaded, doesn't mean any part of it is actually active.

    An example of what I mean can be seen with this bit I use to enable support for pre-compressed gzip requests.

    <IfModule !deflate_module>
    	<IfModule headers_module>
    		<IfModule rewrite_module>
    			<FilesMatch "\.html\.gz$">
    				Header set Content-Encoding gzip
    				AddType text/html gz
    			</FilesMatch>
    		
    			RewriteEngine On
    			RewriteCond %{HTTP:accept-encoding} gzip
    			RewriteCond %{REQUEST_FILENAME}.gz -f
    			RewriteRule \.html$ %{REQUEST_URI}.gz
    		</IfModule>
    	</IfModule>
    </IfModule>
    Code (markup):
    Because the directives mod_deflate makes available can conflict with my pre-compressed files, essentially double-compressing them, I have to make sure mod_deflate isn't active before I allow the pre-compressed versions to be used. However, !deflate_module only tells me that mod_deflate is not loaded. It could be possible that mod_deflate is loaded, but none of the conflicting confituration options are active, meaning it would be safe for me to comment out the <IfModule !deflate_module> bit.
     
    joebert, Aug 11, 2010 IP
  4. JMaste

    JMaste Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks a lot...
     
    JMaste, Aug 15, 2010 IP