+3  A: 

Not the most elegant solution, but you could create a directory, insert a .htaccess and a small php file and try to open it with curl/file_get_contents() from your actual code:

.htaccess

RewriteEngine on
RewriteRule ^(.*?)$ index.php?myparam=$1

index.php

<?php
//open with file_get_contents("http://yoursite/directory/test")
if($_GET['myparam']){die("active");}
?>

Although this might be acceptable during an installation, for performance reasons this shouldn't be used for every request on your site! Save the information somewhere (sqlite/textfile).

Update

Apache specific, but apache_get_modules()/phpinfo() in combination with array_search/strpos is maybe helpful to you.

merkuro
+2  A: 

PHP has server-specific functions for Apache, IIS and NSAPI servers. I only have Apache but as merkuro suggested this works as expected:

<?php
  if (in_array('mod_rewrite',@apache_get_modules()))
    echo 'mod_rewrite enabled';
  else
    echo 'mod_rewrite not enabled';
?>

As PHP server-specific functions don't cover all the servers you'd like to test in this probably isn't the best solution.

I'd recommend merkuro's first answer - implementing then testing it in script. I believe it's the only way to get a good result.

Hope that helps!

Al
Yes, thank you for the answer. I completely forgot about the apache specific functions.
HabarNam