• The current compatibility test relies on PHP being installed as mod_php. Here is a method of testing that does not have this dependency.

    Place the following in .htaccess, then check for the corresponding environment variables within the compatibility check PHP code.

    
    <IfModule mod_deflate.c>
    SetENV HTTP_MYMODS_deflate 1
    </IfModule>
    <IfModule mod_env.c>
    SetENV HTTP_MYMODS_env 1
    </IfModule>
    <IfModule mod_expires.c>
    SetENV HTTP_MYMODS_expires 1
    </IfModule>
    <IfModule mod_filter.c>
    SetENV HTTP_MYMODS_filter 1
    </IfModule>
    <IfModule mod_ext_filter.c>
    SetENV HTTP_MYMODS_ext_filter 1
    </IfModule>
    <IfModule mod_headers.c>
    SetENV HTTP_MYMODS_headers 1
    </IfModule>
    <IfModule mod_mime.c>
    SetENV HTTP_MYMODS_mime 1
    </IfModule>
    <IfModule mod_rewrite.c>
    SetENV HTTP_MYMODS_rewrite 1
    </IfModule>
    <IfModule mod_setenvif.c>
    SetENV HTTP_MYMODS_setenvif 1
    </IfModule>
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • bgdstr

    (@bogdanstratulat)

    Thank you for sharing this with our users.
    This indeed may be hlpful in some cases.

    Kind regards!
    Bogdan S.

    I had wordfence-waf already in auto_prepend so i placed the snippet below into the htaccess:

    # .htaccess snippet 
    # W3TC Apache2 modules test with fastcgi
    
    <IfModule mod_fastcgi.c>
    	<IfModule mod_deflate.c>
    	SetENV HTTP_X_A2ENMODS_FPM_deflate mod_loaded
    	</IfModule>
    	<IfModule mod_env.c>
    	SetENV HTTP_X_A2ENMODS_FPM_env mod_loaded
    	</IfModule>
    	<IfModule mod_expires.c>
    	SetENV HTTP_X_A2ENMODS_FPM_expires mod_loaded
    	</IfModule>
    	<IfModule mod_filter.c>
    	SetENV HTTP_X_A2ENMODS_FPM_filter mod_loaded
    	</IfModule>
    	<IfModule mod_ext_filter.c>
    	SetENV HTTP_X_A2ENMODS_FPM_ext_filter mod_loaded
    	</IfModule>
    	<IfModule mod_headers.c>
    	SetENV HTTP_X_A2ENMODS_FPM_headers mod_loaded
    	</IfModule>
    	<IfModule mod_mime.c>
    	SetENV HTTP_X_A2ENMODS_FPM_mime mod_loaded
    	</IfModule>
    	<IfModule mod_rewrite.c>
    	SetENV HTTP_X_A2ENMODS_FPM_rewrite mod_loaded
    	</IfModule>
    	<IfModule mod_setenvif.c>
    	SetENV HTTP_X_A2ENMODS_FPM_setenvif mod_loaded
    	</IfModule>
    </IfModule>
    
    #
    # .htaccess snippet END

    And this code was placed into the wordfence-waf auto_prepended php:

    <?php
    
    // Only do this if the function apache_get_modules() does not exist, despite Util_Environment::is_apache() is true
    if ( ! function_exists( 'apache_get_modules' ) ) {
    	function apache_get_modules() {
    		// Pre-Fake some defaults
    		$apache_returned_modules = array( 'core','mod_version','http_core','mod_so');
    		// Check for mod_loaded in _SERVER env
    		$env_mods_loaded = array_keys($_SERVER,'mod_loaded',true);
    
    		foreach ($env_mods_loaded as $env_mod_loaded) {
    			if ( strpos($env_mod_loaded,'HTTP_X_A2ENMODS_FPM_') !== false ) {
    				$apache_returned_modules[] = preg_replace('/.*HTTP_X_A2ENMODS_FPM_/', 'mod_', $env_mod_loaded);
    			}
    		}
    		return $apache_returned_modules;
    	}
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘A way to fix the Compatability Test’ is closed to new replies.