发布日期:2018-03-26
用PHP如何检查是否mod_rewrite是可用的+ 查看更多
用PHP如何检查是否mod_rewrite是可用的
+ 查看更多
发布日期:2018-03-26 14:26
分类:PHP
浏览次数:86
问题描述:
我想是否可以用PHP检查mod_rewrite在 Apache 和 IIS 中是可用的
IIS的ModRewrite已经存在. [点击[http://www.micronovae.com/ModRewrite/ModRewrite.html]]
所以我在寻找PHP脚本检查Apache和IIS的mod_rewrite
有人知道这样的脚本并回答么
特别是微软的IIS¶
我想是否可以用PHP检查mod_rewrite在 Apache 和 IIS 中是可用的
IIS的ModRewrite已经存在. [点击[http://www.micronovae.com/ModRewrite/ModRewrite.html]]
所以我在寻找PHP脚本检查Apache和IIS的mod_rewrite
有人知道这样的脚本并回答么
特别是微软的IIS¶
感谢!
回答:
如果你使用mod_php,你可以使用apache_get_modules(),这个函数将会返回所有可用模块的数组,所以检查mod_rewrite是否可用,你可以:
in_array('mod_rewrite', apache_get_modules());
不幸的是,你可能使用CGI做这个,这样可能会有一点复杂
你可以测试下面的
strpos(shell_exec('/usr/local/apache/bin/apachectl -l'), 'mod_rewrite') !== false