ifacethoughts

is_apache

is_apache global variable can be used to detect which webserver WordPress is running on. It is set in [wordpress root folder]/wp-includes/vars.php as part of the server detection code. It is set in the following manner:

$is_apache=(strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') || 
     strstr($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed')) ? 1 : 0;

is_apache is set to 1 (which means true) if the webserver is either Apache or Litespeed (WordPress.com, i.e., even this blog runs on Litespeed today), which means that both of them can be considered to be practically the same. The other webserver that WordPress supports is Microsoft IIS which is indicated using the global variable is_IIS.

It is possible that certain hosts block the server variable SERVER_SOFTWARE, which can cause problems in using permalinks. is_apache global variable can be forcibly set to 1 for an assured Apache/Litespeed webserver as advised here.

Plugin and theme developers can use these global variables for any web server specific features. One of the biggest features of WordPress – permalinks – requires identification of the web server.

Back to full list of global variables.

Technorati tags: , , , ,

Discussion [Participate or Link]

  1. Abhijit Nadgouda @ iface » Blog Archive » Wordpress Global Variables said:

    […] $is_apache […]

  2. Abhijit Nadgouda @ iface » Blog Archive » is_IIS said:

    […] Just like is_apache, is_IIS is part of the web server detection. It is set in [wordpress root folder]/wp-includes/vars.php in the following manner: […]

  3. Abhijit Nadgouda’s List of WordPress Global Variables « Lorelle on WordPress said:

    […] Browser and Server Detection: is_winIE or is_macIE, is_IIS, is_apache, and wp_db_version […]

  4. Wordpress Global Variables | iface thoughts said:

    […] $is_apache […]

  5. references» Blog Archive » Wordpress Global Variables said:

    […] $is_apache […]

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
My bookmarks

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.