Home > Backend Development > PHP Tutorial > PHP method to detect whether the apache mod_rewrite module is installed, apachemod_rewrite_PHP tutorial

PHP method to detect whether the apache mod_rewrite module is installed, apachemod_rewrite_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:03:45
Original
771 people have browsed it

How to detect whether apache mod_rewrite module is installed by php, apachemod_rewrite

This article describes the method of detecting whether apache mod_rewrite module is installed by php. Share it with everyone for your reference. The specific implementation method is as follows:

/**
 * @title Check if Apache's mod_rewrite is installed.
 * 
 * @author Pierre-Henry Soria <ph7software@gmail.com>
 * @copyright (c) 2013, Pierre-Henry Soria. All Rights Reserved.
 * @return boolean
 */
function isRewriteMod()
{
  if (function_exists('apache_get_modules'))
  {
    $aMods = apache_get_modules();
    $bIsRewrite = in_array('mod_rewrite', $aMods);
  }
  else
  {
    $bIsRewrite = (strtolower(getenv('HTTP_MOD_REWRITE')) == 'on');
  }
  return $bIsRewrite;
}
Copy after login

How to use:

if (!isRewriteMod()) exit('Please install Apache mod_rewrite module.');
Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/967747.htmlTechArticlephp method to detect whether the apache mod_rewrite module is installed, apachemod_rewrite This article describes the method of php to detect whether the apache mod_rewrite module is installed . Share it with everyone for your reference...
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template