<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Basil Vandegriend: Professional Software Development &#187; WordPress</title>
	<atom:link href="http://www.basilv.com/psd/blog/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.basilv.com/psd</link>
	<description></description>
	<lastBuildDate>Wed, 25 Jan 2012 13:23:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Resolving PHP No Input File Specified Error for WordPress on IIS</title>
		<link>http://www.basilv.com/psd/blog/2009/resolving-php-no-input-file-specified-error-for-wordpress-on-iis</link>
		<comments>http://www.basilv.com/psd/blog/2009/resolving-php-no-input-file-specified-error-for-wordpress-on-iis#comments</comments>
		<pubDate>Sun, 30 Aug 2009 14:32:38 +0000</pubDate>
		<dc:creator>Basil Vandegriend</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.basilv.com/psd/?p=431</guid>
		<description><![CDATA[My website was recently almost entirely non-functional for several days. I noticed the problem by the sharp drop in my traffic statistics, and a quick check of the site revealed that most of my pages were displaying a PHP message "No input file specified error" rather than the actual content. After a quick flurry of [...]]]></description>
			<content:encoded><![CDATA[<p>My website was recently almost entirely non-functional for several days. I noticed the problem by the sharp drop in my traffic statistics, and a quick check of the site revealed that most of my pages were displaying a PHP message "No input file specified error" rather than the actual content. After a quick flurry of activity on my part I was able to fix the issue, but it required more work than I expected. This article provides the details of my investigation, and more importantly the solution I used to fix the problem.</p>
<h3>The Problem</h3>
<p>My first step was to determine exactly what was wrong. My home page displayed fine, but all other links to articles, tags, and categories were not working. I then tried URLs corresponding to actual files on the web server, and these resolved fine. My site is powered by <a href="http://www.wordpress.org/">WordPress</a> running on a Microsoft IIS web server. The IIS <a href="http://isapirewrite.com/">ISAPI_rewrite</a> module is used to rewrite URLs to provide custom SEO-friendly URLs for permanent links (permalinks in WordPress terminology), as described in my article <a href="http://www.basilv.com/psd/blog/2006/running-wordpress-20-under-iis">Running WordPress 2.0 under IIS</a>. My problem was that these WordPress permalinks were not working. I confirmed this by going to the Permalink Settings page within my WordPress Site Admin and changing the common settings to default – all pages were now accessible.</p>
<p>This problem happened to me shortly after I upgraded to WordPress 2.8, so I suspected a compatibility issue between WordPress and PHP, although I had no idea why I had not noticed the problem when I initially upgraded. I checked the <a href="http://wordpress.org/about/requirements/">WordPress installation requirements</a> and confirmed that the version of PHP I was running (v4.4.9) was greater than the minimum requirement of 4.3 or greater.</p>
<h3>Solution #1</h3>
<p>I then turned to Google to find out if others had experienced this problem and what they had done about it. My search surprisingly turned up mostly unhelpful results, with the exception of one article: <a href="http://www.terencechang.com/2008/08/28/codeigniter-no-input-file-specified-php-5-apache-2/">CodeIgniter - No input file specified error - .htaccess - PHP5 - Apache 2</a>. This lifesaver article provided the first solution that truly worked. While this article provides two separate solutions and states that only one of the two needs to be used, I found I had to use both. The changes I had to make were:</p>
<ol>
<li>Modify my PHP settings (in php.ini) to set <code>cgi.fix_pathinfo = 0</code>. </li>
<li>Change my URL rewriting (in httpd.ini) to rewrite custom URLs into URLs starting with "index.php?" instead of just "index.php" – i.e. add a question mark '?' to the end of "index.php". The revised rewrite rule is: <code>RewriteRule /psd/(.*) /psd/index.php?/$1 [L,U]</code>.
</ol>
<p>I experienced difficulties testing this solution – it appeared as though the web server was caching the PHP or rewrite settings and not immediately applying my changes. This may have been why I never noticed the problem immediately after upgrading to WordPress 2.8.</p>
<h3>Solution #2</h3>
<p>Once I determined the problem was related to PHP, I decided to upgrade to PHP version 5 rather than PHP version 4. I requested the upgrade while I resolved the problem using the above solution. Once the upgrade to PHP version 5 was completed, I reverted my URL rewriting change and found that the problem did not reoccur. So I now strongly recommend only running WordPress 2.8 under IIS using PHP version 5.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.basilv.com/psd/blog/2009/resolving-php-no-input-file-specified-error-for-wordpress-on-iis/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Version Information WordPress Plugin Version 1.1 Available</title>
		<link>http://www.basilv.com/psd/blog/2008/version-information-wordpress-plugin-version-11-available</link>
		<comments>http://www.basilv.com/psd/blog/2008/version-information-wordpress-plugin-version-11-available#comments</comments>
		<pubDate>Thu, 07 Aug 2008 03:41:13 +0000</pubDate>
		<dc:creator>Basil Vandegriend</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.basilv.com/psd/?p=123</guid>
		<description><![CDATA[I have just released version 1.1 of my Version Information WordPress plugin. It is available for download from my Software page. For this release I made updates for WordPress 2.5 and 2.6, primarily around the display of information.]]></description>
			<content:encoded><![CDATA[<p>I have just released version 1.1 of my Version Information <a href="http://www.wordpress.org">WordPress</a> plugin. It is available for download from my <a href="http://www.basilv.com/psd/software">Software</a> page. For this release I made updates for WordPress 2.5 and 2.6, primarily around the display of information.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.basilv.com/psd/blog/2008/version-information-wordpress-plugin-version-11-available/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Version Information WordPress Plugin</title>
		<link>http://www.basilv.com/psd/blog/2007/version-information-wordpress-plugin</link>
		<comments>http://www.basilv.com/psd/blog/2007/version-information-wordpress-plugin#comments</comments>
		<pubDate>Sun, 21 Oct 2007 18:12:48 +0000</pubDate>
		<dc:creator>Basil Vandegriend</dc:creator>
				<category><![CDATA[tools]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.basilv.com/psd/blog/2007/version-information-wordpress-plugin</guid>
		<description><![CDATA[I have added a new WordPress plugin called Version Information to my Software page. This plugin displays version and configuration information for WordPress, PHP, MySQL, and the web server. A summary is displayed in the Site Admin dashboard and more details are displayed under a Version Information page under the Site Admin Plugins menu This [...]]]></description>
			<content:encoded><![CDATA[<p>I have added a new <a href="http://www.wordpress.org">WordPress</a> plugin called <strong>Version Information</strong> to my <a href="http://www.basilv.com/psd/software">Software</a> page. This plugin displays version and configuration information for WordPress, PHP, MySQL, and the web server. A summary is displayed in the Site Admin dashboard and more details are displayed under a Version Information page under the Site Admin Plugins menu</p>
<p>This plugin is useful if you have your website hosted by an ISP and need to determine the version or configuration of your web infastructure stack to resolve problems or determine the compatibility of 3rd party software.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.basilv.com/psd/blog/2007/version-information-wordpress-plugin/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Running WordPress 2.0 under IIS</title>
		<link>http://www.basilv.com/psd/blog/2006/running-wordpress-20-under-iis</link>
		<comments>http://www.basilv.com/psd/blog/2006/running-wordpress-20-under-iis#comments</comments>
		<pubDate>Thu, 12 Jan 2006 17:54:16 +0000</pubDate>
		<dc:creator>Basil Vandegriend</dc:creator>
				<category><![CDATA[tools]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.basilv.com/psd/blog/2006/running-wordpress-20-under-iis</guid>
		<description><![CDATA[WordPress is the blogging / content management software I use to run this site. WordPress was designed to run under the Apache web server. However, the hosting company for my website uses Microsoft's IIS web server to serve most content, including PHP files which WordPress uses. Setting up WordPress to work under IIS was non-trivial, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.wordpress.org">WordPress</a> is the blogging / content management software I use to run this site. WordPress was designed to run under the <a href="http://httpd.apache.org/">Apache web server</a>. However, the <a href="http://lfchosting.com/cgi-bin/redirect.cgi?referrer=basilv.com">hosting company</a> for my website uses Microsoft's IIS web server to serve most content, including PHP files which WordPress uses. Setting up WordPress to work under IIS was non-trivial, particularly since existing instructions on the web were for version 1.5, while I wanted to run the recently released version 2.0. So I thought it would be helpful to describe the steps I took.</p>
<p>All examples use my website, in which I have WordPress running under a subdirectory of the domain (www.basilv.com/psd) instead of directly under the root. So WordPress itself is installed in directory /psd under my root website directory. Take this into account when using my examples.</p>
<p>First, a little about how WordPress works. WordPress serves all normal content via the index.php file. Given a URL such as http://www.basilv.com/psd/index.php/blog/category/miscellaneous/, the WordPress code called by index.php parses out the path after index.php (/blog/category/miscellaneous) and displays the content associated with that path.</p>
<p>The first problem running under IIS is that the above URL is interpreted to be pointing to a directory - index.php is considered a directory instead of a PHP file to be invoked. To change this behavior, a php.ini file must be created and placed in the website root directory with the following contents:</p>
<pre class="prettyprint">
cgi.fix_pathinfo = 1
cgi.force_redirect = 0
</pre>
<p>The second problem I encountered is that the .htaccess file provided by WordPress is considered invalid by IIS - it serves a HTTP ERROR 500 whenver trying to access anything in a directory containing an invalid .htaccess file. The solution is simply to delete the file.  </p>
<p>WordPress may somewhat work at this point, but with 'ugly' URLs containing index.php in the middle. I wanted clean URLs, so had configured WordPress to use nice permalinks. My permalink structure is /blog/%year%/%postname%. The .htaccess file provided by WordPress uses the <a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html">Apache mod_rewrite module</a> to convert (rewrite) 'clean' URLs to include 'index.php'. (By the way, this is a big improvement over WordPress 1.5, which required quite a complex .htaccess file which WordPress had to update every time a page was added.)  </p>
<p>To use clean URLs, we therefore need URL rewriting capabilities in IIS. The solution is to have the <a href="http://isapirewrite.com/">ISAPI_rewrite</a> module installed on the IIS server. With this module running, a httpd.ini file can be added to the root website directory (not under /psd, where the .htaccess was located) with the rewrite instructions.</p>
<p>Unfortunately, the ISAPI_rewrite module is not 100% compatible with the Apache rewrite module, and in particular is missing some (many?) of the capabilities found in the Apache module. Therefore, the conversion from .htaccess to httpd.ini is non-trivial. Let's look at the .htaccess file found in the /psd directory:</p>
<pre class="prettyprint">
RewriteEngine On
RewriteBase /psd/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /psd/index.php
</pre>
<p>The main lines are the two lines starting with RewriteCond plus the RewriteRule line. What these 3 lines are saying is that for any URL that is <strong>not</strong> a file (!-f) or a directory (!-d), replace the first character of the URL with /psd/index.php. In conjunction with the RewriteBase line, this essentially converts a URL of the form www.basilv.com/psd/foo/bar to  www.basilv.com/psd/index.php/foo/bar.</p>
<p>Directly converting this to ISAPI_rewrite is not possible, because ISAPI_rewrite's RewriteCond directive doesn't support the is-a-file (-f) or is-a-directory (-d) tests, and the RewriteBase directive isn't supported at all. So I wrote rules to convert all URLs starting with /psd to add in the index.php:</p>
<pre class="prettyprint">
RewriteRule ^/psd/$ /psd/index.php [L]
RewriteRule /psd/(.*) /psd/index.php/$1 [L]
</pre>
<p>This worked, partially. The problem is that images and style sheets associated with the theme were not being loaded, because their URLs were also having the index.php added.  I also had some images and files outside of wordpress, but under the /psd directory, that were also incorrectly being rewritten. So I had to add rules for each of these cases before the above rules to map such URLs to themselves and then terminate (the last rule option [L]) before reaching the above rules to add in 'index.php'. Essentially, this is a manual implementation of the RewriteCond rules used in .htaccess to ensure that files &#038; directories do not have their URL mapped. The relevant portion of my final httpd.ini file is:</p>
<pre class="prettyprint">
[ISAPI_Rewrite]

# Rules to ensure that normal content gets through
RewriteRule /psd/software-files/(.*) /psd/software-files/$1 [L]
RewriteRule /psd/images/(.*) /psd/images/$1 [L]
RewriteRule /psd/favicon.ico /psd/favicon.ico [L]

# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /psd/wp-(.*) /psd/wp-$1 [L]

# For normal wordpress content, via index.php
RewriteRule ^/psd/$ /psd/index.php [L]
RewriteRule /psd/(.*) /psd/index.php/$1 [L]
</pre>
<p>When working on the rewrite rules in the httpd.ini file, I ran into problems testing due to the browser cache. I was getting inconsistent / unexpected results due to the browser caching prior results. The solution is to clear the browser cache, which in Firefox can be done via the menu item Tools | Clear Private Data.</p>
<p>Another issue is having WordPress send emails (i.e. when a comment is waiting for moderation).  The default approach used by WordPress doesn't appear to work under Windows.  The solution I found is to install the <a href="http://www.coffee2code.com/archives/2004/06/28/plugin-wpphpmailer/">wpPHPMailer plugin</a> which allows you to configure WordPress to use any SMTP server to send the emails.</p>
<p>One issue I was unable to resolve is a problem with the post preview feature.  Under IIS, post preview doesn't work (due to a 404 error) when the article is in draft status.  The workaround is to change the status to private if you want to preview your post. This problem is due to a defect in WordPress that is fixed in WordPress 2.0.1.</p>
<p>To summarize the steps to get WordPress 2.0 working under IIS:</p>
<ol>
<li>Add php.ini file to correctly resolve URLs containing index.php.</li>
<li>Remove .htaccess file which IIS can't handle.</li>
<li>Install ISAPI_rewrite module on IIS server to provide URL rewriting capabilities.</li>
<li>Provide httpd.ini file to rewrite URLs.</li>
<li>Install and configure <a href="http://www.coffee2code.com/archives/2004/06/28/plugin-wpphpmailer/">wpPHPMailer plugin</a> for sending emails.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.basilv.com/psd/blog/2006/running-wordpress-20-under-iis/feed</wfw:commentRss>
		<slash:comments>54</slash:comments>
		</item>
	</channel>
</rss>

