I'm wondering if you'll be able to see if mod_rewrite is enabled on Apache AND IIS in PHP. Mod rewrite for IIS is available. Check it here.

So, I am searching for a PHP script that inspections for mod_rewrite on Apache and IIS.

Does anybody know such script or can write one?

Specifically for Mircosoft IIS.

Thanks!

You will get a listing of installed apache modules, and appearance against that. Possibly you should check if it is installed by trying to find its .dll (or linux equivalent) file.

If you are using mod_php, you should use apache_get_modules(). This can return a range of all enabled modules, so to see if mod_rewrite is enabled, you can function

in_array('mod_rewrite', apache_get_modules());

Regrettably, you are probably trying to get this done with CGI, which causes it to be a bit more difficult.

You can look at it while using following, though

strpos(shell_exec('/usr/local/apache/bin/apachectl -l'), 'mod_rewrite') !== false

When the above evaulates to true, then mod_write is enabled.

Applying this code.

<?php
 if( ! function_exists('apache_get_modules') ){ phpinfo(); die; }
 $result = ' not available';
 if(in_array('mod_rewrite',apache_get_modules())) $result = ' 

available';

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Check for mod_rewrite</title></head>
<body>
<p><?php echo apache_get_version(),"</p><p>mod_rewrite $result"; ?></p>
</body>
</html>