<?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>Simon Whatley &#187; Apache</title>
	<atom:link href="http://www.simonwhatley.co.uk/tag/apache-2/feed" rel="self" type="application/rss+xml" />
	<link>http://www.simonwhatley.co.uk</link>
	<description>The opposite of every great idea is another great idea</description>
	<lastBuildDate>Wed, 02 Nov 2011 09:28:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Apache RewriteRule and query strings</title>
		<link>http://www.simonwhatley.co.uk/apache-rewriterule-and-query-strings</link>
		<comments>http://www.simonwhatley.co.uk/apache-rewriterule-and-query-strings#comments</comments>
		<pubDate>Fri, 18 Feb 2011 10:56:20 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache HTTP Server]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[SES]]></category>
		<category><![CDATA[url]]></category>
		<category><![CDATA[URL rewriting]]></category>
		<category><![CDATA[webserver]]></category>

		<guid isPermaLink="false">http://www.simonwhatley.co.uk/?p=3855</guid>
		<description><![CDATA[At first glance, the way the Apache mod_rewrite module handles query strings can be a little intimidating. mod_rewrite works by sitting on your server in a file called htaccess, and “catching” requests for URL‘s. It then checks these URL request against a series of rules and conditions you have set. If the request meets any of the rules and conditions, it applies then necessary changes to the URL, then reprocesses the request with the changes you have directed.]]></description>
			<content:encoded><![CDATA[<p>At first glance, the way the Apache <code>mod_rewrite</code> module handles query strings can be a little intimidating. <code>mod_rewrite</code> works by sitting on your server in a file called <code>htaccess</code>, and &#8220;catching&#8221; requests for <abbr title="Universal Resource Locator">URL</abbr>&#8216;s. It then checks these <abbr title="Universal Resource Locator">URL</abbr> request against a series of rules and conditions you have set. If the request meets any of the rules and conditions, it applies then necessary changes to the <abbr title="Universal Resource Locator">URL</abbr>, then reprocesses the request with the changes you have directed. Apache helpfully provides some <a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritecond" title="Apache RewriteCond Directive" target="_blank" rel="nofollow">RewriteCond documentation</a></p>
<p>The most common mistake people make when thinking of <abbr title="Universal Resource Locator">URL</abbr> redirection with <code>mod_rewrite</code>, is they believe it creates something, or changes something. It doesn&#8217;t.</p>
<p>Here is a simple example, redirecting a page dependent upon its query string. The rewrite condition and rule looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
RewriteRule ^page\.php$ http://www.example.com/page/%1.php [R=302,L]</pre></div></div>

<p>The rewrite condition matches a numerical ID between 0 and 9. According to the official documentation, you would expect the following behaviour:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/page.php?id=1 -&gt; http://www.example.com/page/1.php
/page.php?id=10 -&gt; http://www.example.com/page/10.php</pre></div></div>

<p>However, if you don’t append something new, then <strong>the original query is passed through</strong> by default. This results in the following:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/page.php?id=1 -&gt; http://www.example.com/page/1.php?id=1
/page.php?id=10 -&gt; http://www.example.com/page/10.php?id=10</pre></div></div>

<p>If you want to discard the original query string you must append an empty question mark at the end of the rule; the <strong>query string not append</strong> or <strong>query string discard</strong> flag.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
RewriteRule ^page\.php$ http://www.example.com/page/%1.php? [R=302,L]</pre></div></div>

<p>Putting it all together, here&#8217;s a quick reference for dealing with query string in a RewriteRule.</p>
<p>Keep original query (i.e., the default behaviour)</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">RewriteRule ^page\.php$ /target.php [L]
# from http://www.example.com/page.php?foo=bar
# to http://www.example.com/target.php?foo=bar</pre></div></div>

<p>Discard original query</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">RewriteRule ^page\.php$ /target.php? [L]
# from http://www.example.com/page.php?foo=bar
# to http://www.example.com/target.php</pre></div></div>

<p>Replace original query</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">RewriteRule ^page\.php$ /target.php?bar=baz [L]
# from http://www.example.com/page.php?foo=bar
# to http://www.example.com/target.php?bar=foo</pre></div></div>

<p>Append new query to original query</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">RewriteRule ^page\.php$ /target.php?bar=baz [QSA,L]
# from http://www.example.com/page.php?foo=bar
# to http://www.example.com/target.php?foo=bar&amp;bar=foo</pre></div></div>

<p>Dave Child has created a great <a href="http://www.addedbytes.com/cheat-sheets/mod_rewrite-cheat-sheet/" title="mod_rewrite cheat sheet" target="_blank" rel="nofollow">mod_rewrite cheat sheet</a>; a one-page reference sheet, listing flags for the <code>RewriteRule</code> and <code>RewriteCond</code> directives, list of server variables, a regular expression guide and several examples of common rules.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6475233631580417";
/* 468x60 Basic */
google_ad_slot = "7117418273";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwhatley.co.uk/apache-rewriterule-and-query-strings/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Apache .htaccess query string redirects</title>
		<link>http://www.simonwhatley.co.uk/apache-htaccess-query-string-redirects</link>
		<comments>http://www.simonwhatley.co.uk/apache-htaccess-query-string-redirects#comments</comments>
		<pubDate>Thu, 17 Feb 2011 21:53:42 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache HTTP Server]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[SES]]></category>
		<category><![CDATA[url]]></category>
		<category><![CDATA[URL rewriting]]></category>
		<category><![CDATA[webserver]]></category>

		<guid isPermaLink="false">http://www.simonwhatley.co.uk/?p=3857</guid>
		<description><![CDATA[One of the most common tasks performed by Apache and htaccess is the manipulation of a URL and configuring a redirect for a specific page.]]></description>
			<content:encoded><![CDATA[<p>One of the most common tasks performed by Apache and <code>htaccess</code> is the manipulation of a <abbr title="Universal Resource Locator">URL</abbr> and configuring a redirect for a specific page. Creating a <strong>single page redirect</strong> in Apache is a simple task, which uses <code>mod_alias</code> module.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Redirect /page.php http://www.example.com/target.php</pre></div></div>

<p>More commonly, however, you&#8217;re likely to want to do a <strong>mass-redirection of pages</strong>. To accomplish this, you may use the <code>RedirectMatch</code> directive.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">RedirectMatch ^/category/(.*)$ http://www.example.com/topic/$1</pre></div></div>

<p>This will redirect any page from the <code>category</code> folder to the corresponding one in <code>topic</code> folder with a convenient <strong>one-by-one redirect</strong>.</p>
<p>However, neither <code>Redirect</code> nor <code>RedirectMatch</code> allow you to specify a query string for the redirect source. In other words, the following statements are invalid and they&#8217;ll simply be ignored.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># single page redirect
Redirect /page.php?id=1  http://www.example.com/page/1
Redirect /page.php?id=10  http://www.example.com/page/10
&nbsp;
# multi-page redirect
RedirectMatch ^/page.php?id=([0-9]*)$  http://www.example.com/page/$1</pre></div></div>

<p>The solution requires a change of focus from Apache&#8217;s <code>mod_alias</code> module to the <code>mod_rewrite</code> module. Here’s an example.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">RewriteEngine On
RewriteCond %{REQUEST_URI}  ^/page\.php$
RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
RewriteRule ^(.*)$ http://www.example.com/page/%1.php [L,R=301]</pre></div></div>

<p>The <code>mod_rewrite</code> module uses a rule-based rewriting engine (based on a regular-expression parser) to rewrite requested <abbr title="Universal Resource Locator">URL</abbr>s on the fly. It supports an unlimited number of rules and an unlimited number of attached rule conditions for each rule, to provide a really flexible and powerful <abbr title="Universal Resource Locator">URL</abbr> manipulation mechanism. The <abbr title="Universal Resource Locator">URL</abbr> manipulations can depend on various tests, of server variables, environment variables, <abbr title="HyperText Transfer Protocol">HTTP</abbr> headers, or time stamps.</p>
<p>So what does this all mean with respect to the above example?</p>
<p>The first line enables the <code>RewriteEngine</code> module. Note that <code>mod_rewrite</code> Apache module must be installed and enabled in order to use the <code>RewriteEngine</code>.</p>
<p>The <code>RewriteCond</code> statements set all the rewrite conditions. The fourth line, the real rewrite directive, will be executed <strong>if and only if all conditions are satisfied by the current request</strong>.</p>
<p>The first condition is for the page I need to redirect. This condition is included to prevent any unexpected errors if other pages are using the ID variable. Next, I base the rewrite rule on the value for the current request&#8217;s query string. The ID value within the regular expression is &#8220;wrapped&#8221; to be able to reuse the match later as a back-reference.</p>
<p>The final line is the rewrite rule. This line looks similar to the <code>RedirectMatch</code> statement. It specifies the redirection source, then the redirection target. The value captured by the second <code>RewriteCond</code> is referenced in the target with the <code>%N</code> keyword (in this example %1). The <code>RewriteRule</code> also includes a comma-separated list of flags that should be applied to the rule. In this case, <code>L</code> stops the rewriting process immediately whilst <code>R=301</code> specifies a permanent external redirect (301 is an <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" title="HTTP Status Codes" target="_blank" rel="nofollow">HTTP Status Code</a>).</p>
<p><strong>Further reading:</strong></p>
<ul>
<li><a href="http://httpd.apache.org/docs/2.2/rewrite/" title="Apache URL rewriting guide" target="_blank" rel="nofollow">Apache URL rewriting guide</a></li>
<li><a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html" title="Apache mod_rewrite" target="_blank" rel="nofollow">Apache mod_rewrite</a></li>
<li><a href="http://httpd.apache.org/docs/2.2/mod/mod_alias.html" title="Apache mod_alias" target="_blank" rel="nofollow">Apache mod_alias</a></li>
</ul>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6475233631580417";
/* 468x60 Basic */
google_ad_slot = "7117418273";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwhatley.co.uk/apache-htaccess-query-string-redirects/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apachectl Ulimit Error</title>
		<link>http://www.simonwhatley.co.uk/apachectl-ulimit-error</link>
		<comments>http://www.simonwhatley.co.uk/apachectl-ulimit-error#comments</comments>
		<pubDate>Tue, 15 Feb 2011 16:08:55 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[apachectl]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://www.simonwhatley.co.uk/?p=3820</guid>
		<description><![CDATA[Restarting Apache on my MacBook Pro today, using the command line argument sudo apachectl -k start resulted in a rather strange error]]></description>
			<content:encoded><![CDATA[<p>Restarting Apache on my MacBook Pro today, using the command line argument <code>sudo apachectl -k start</code> resulted in a rather strange error:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument</pre></div></div>

<p>After a little investigating it turned out to be caused by an update in the <code>apachectl</code> script to OSX 10.6.5. </p>
<p>The <code>ULIMIT_MAX_FILES</code> variable increases the maximum number of file descriptors allowed per child process. This is critical for configurations that use many file descriptors, such as mass vhosting, or a multithreaded server.</p>
<p>A quick edit of the the <code>apachectl</code> script and it&#8217;ll be back working.</p>
<p>I use TextMate, so the command is:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">sudo mate /usr/sbin/apachectl</pre></div></div>

<p>You&#8217;ll be prompted for your password.</p>
<p>Once the <code>apachectl</code> file is open, look for the following line (for me it was line 64):</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">ULIMIT_MAX_FILES=&quot;ulimit -S -n `ulimit -H -n`&quot;</pre></div></div>

<p>and replace with the following:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">ULIMIT_MAX_FILES=&quot;ulimit -S -n&quot;</pre></div></div>

<p>This will set the correct command that increases the maximum number of file descriptors allowed per child process.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwhatley.co.uk/apachectl-ulimit-error/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up PHP on Mac OSX 10.6 (Snow Leopard)</title>
		<link>http://www.simonwhatley.co.uk/setting-up-php-on-mac-osx-10-6-snow-leopard</link>
		<comments>http://www.simonwhatley.co.uk/setting-up-php-on-mac-osx-10-6-snow-leopard#comments</comments>
		<pubDate>Wed, 31 Mar 2010 20:40:05 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache HTTP Server]]></category>
		<category><![CDATA[http.conf]]></category>
		<category><![CDATA[Leopard]]></category>
		<category><![CDATA[Mac OS X 10.5]]></category>
		<category><![CDATA[Mac OS X 10.6]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php.ini]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[Web Server]]></category>

		<guid isPermaLink="false">http://www.simonwhatley.co.uk/?p=2197</guid>
		<description><![CDATA[Since Apple launched Mac OS X 10.5 (Leopard), PHP has been installed by default, albeit disabled. Here is a quick run through of what you need to do to get it up and running.]]></description>
			<content:encoded><![CDATA[<p>Since Apple launched Mac OS X 10.5 (Leopard), PHP has been installed by default, albeit disabled. Here is a quick run through of what you need to do to get it up and running:</p>
<ol>
<li>Enable the PHP5 module in Apache:

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">LoadModule php5_module libexec/apache2/libphp5.so</pre></div></div>

<p>This will normally involve simply removing the hash symbol (#) at the beginning of the line.</li>
<li>Restart Apache via the command line:

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">sudo apachectl restart -t</pre></div></div>

<p>The <code>-t</code> is used to run a syntax check on the Apache file, to ensure you haven&#8217;t broken anything.
</li>
<li>Locate the <code>php.ini.default</code> file in the <code>/etc/</code> directory and rename it to simply <code>php.ini</code> by running the following commands:

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">cd /etc
sudo cp php.ini.default php.ini
sudo chmod 666 php.ini</pre></div></div>

</li>
<li>Create a file in the web server&#8217;s document root, in this case an <code>index.php</code> file, with the following text included:

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&lt;?php phpinfo() ?&gt;</pre></div></div>

<p>When you browse to that file, it will display information regarding your PHP installation. (Be sure to remove this after use and certainly don&#8217;t include it in a production environment.)</li>
</ol>
<p>That is all you need to do. Easy huh?</p>
<p>As a point to note, if you need to make changes to either the <code>http.conf</code> file or <code>php.ini</code>, you will need administrative access and will need to restart the Apache server for the chances to take effect.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6475233631580417";
/* 468x60 Basic */
google_ad_slot = "7117418273";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwhatley.co.uk/setting-up-php-on-mac-osx-10-6-snow-leopard/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Configure Apache to GZip Your Components</title>
		<link>http://www.simonwhatley.co.uk/how-to-configure-apache-to-gzip-your-components</link>
		<comments>http://www.simonwhatley.co.uk/how-to-configure-apache-to-gzip-your-components#comments</comments>
		<pubDate>Wed, 03 Feb 2010 15:26:38 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache HTTP Server]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DEFLATE]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[Yahoo]]></category>
		<category><![CDATA[ZIP]]></category>

		<guid isPermaLink="false">http://www.simonwhatley.co.uk/?p=2332</guid>
		<description><![CDATA[Compressing your Web components will help speed up your Website. The majority of your visitors will benefit as most all Web browsers support GZip compression. You’ll want to compress all text, which includes HTML, CSS, JavaScript, XML, JSON, etc.]]></description>
			<content:encoded><![CDATA[<p>Compressing your Web components will help speed up your Website.  The majority of your visitors will benefit as most all Web browsers support <abbr title="GNU zip">GZip</abbr> compression.  You’ll want to compress all text, which includes <abbr title="HyperText Markup Language">HTML</abbr>, <abbr title="Cascading Style Sheets">CSS</abbr>, JavaScript, <abbr title="eXtensible Markup Language">XML</abbr>, <abbr title="JavaScript Object Notation">JSON</abbr>, etc.</p>
<p>Apache 2.x uses <code>mod_deflate</code>. Much like <a href="/how-to-set-an-expires-header-in-apache" title="setting expires headers">setting expires headers</a>, this will save you bandwidth and server load, because it allows output from your server to be compressed before being sent to the client over the network.</p>
<p>The deflate module is not compiled by default and must be enabled in the Apache <em>httpd.conf</em> file. Make sure the following is present and uncommented (remove preceding the #):</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">LoadModule deflate_module modules/mod_deflate.so</pre></div></div>

<p>To set <abbr title="GNU zip">GZip</abbr> compression, simply add the following to the <virtualHost> section of your Apache <em>vhost</em> configuration:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html</pre></div></div>

<p>Alternatively you can add it to your <em>htaccess</em> file in an <code>&lt;ifModule mod_deflate.c&gt;&lt;/ifModule&gt;</code> block.</p>
<p>All you really need is the first line. The <code>BrowserMatch </code>lines are there to handle issues with older browsers such as Internet Explorer 5.</p>
<p>You can read all about <abbr title="GNU zip">GZip</abbr> by reading Yahoo!’s <a href="http://developer.yahoo.com/performance/rules.html#gzip" title="Yahoo! Best Practices for Speeding Up Your Web Site Guide" target="_blank" rel="nofollow">Best Practices for Speeding Up Your Web Site</a> guide.</p>
<p>Alternatively, read the <a href="http://httpd.apache.org/docs/2.0/mod/mod_deflate.html" title="Apache mod_deflate documentation" target="_blank" rel="nofollow">Apache mod_deflate documentation</a>.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6475233631580417";
/* 468x60 Basic */
google_ad_slot = "7117418273";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwhatley.co.uk/how-to-configure-apache-to-gzip-your-components/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Set an Expires Header in Apache</title>
		<link>http://www.simonwhatley.co.uk/how-to-set-an-expires-header-in-apache</link>
		<comments>http://www.simonwhatley.co.uk/how-to-set-an-expires-header-in-apache#comments</comments>
		<pubDate>Wed, 03 Feb 2010 15:06:25 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache HTTP Server]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[expires header]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[stylesheets]]></category>
		<category><![CDATA[Web browsers]]></category>
		<category><![CDATA[Yahoo! Inc.]]></category>

		<guid isPermaLink="false">http://www.simonwhatley.co.uk/?p=2323</guid>
		<description><![CDATA[Setting an Expires (or Cache-Control) header in Apache will help speed up your website. I'm running Apache 2.x, and define an expires header for all of the site's static assets (images, stylesheets, and scripts).]]></description>
			<content:encoded><![CDATA[<p>Setting an Expires (or Cache-Control) header in Apache will help speed up your website. I&#8217;m running Apache 2.x, and define an expires header for all of the site&#8217;s static assets (images, stylesheets, and scripts).</p>
<p>In Apache, <code>mod_expires</code> is a module that allows you to set a given period of time to live for web pages and other objects served from web pages. The idea is to inform web browsers how often they should reload objects from the server. This will save you bandwidth and server load, because clients who follow the header will reload objects less frequently.</p>
<p>The expires module is <strong>not</strong> compiled by default and must be enabled in the Apache <em>httpd.conf</em> file. Make sure the following is present and uncommented (remove preceding the #):</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">LoadModule expires_module modules/mod_expires.so</pre></div></div>

<p>To set an expires header, simply add the following to the <code>&lt;virtualHost&gt;</code> section of your Apache <em>vhost</em> configuration:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">ExpiresActive On
ExpiresByType image/gif &quot;access plus 1 months&quot;
ExpiresByType image/jpg &quot;access plus 1 months&quot;
ExpiresByType image/jpeg &quot;access plus 1 months&quot;
ExpiresByType image/png &quot;access plus 1 months&quot;
ExpiresByType image/vnd.microsoft.icon &quot;access plus 1 months&quot;
ExpiresByType image/x-icon &quot;access plus 1 months&quot;
ExpiresByType image/ico &quot;access plus 1 months&quot;
ExpiresByType application/javascript “now plus 1 months”
ExpiresByType application/x-javascript “now plus 1 months”
ExpiresByType text/javascript “now plus 1 months”
ExpiresByType text/css “now plus 1 months”
ExpiresDefault &quot;access plus 1 days&quot;</pre></div></div>

<p>Alternatively you can add it to your <em>htaccess</em> file in an <code>&lt;ifModule mod_expires.c&gt;&lt;/ifModule&gt;</code> block.</p>
<p>If you need to change the length of time a type expires, simply change <em>access plus 1 months</em> to the appropriate length of time, e.g. <em>access plus 1 days</em>, <em>access plus 365 days</em> etc. The time length is by default specified in seconds, but you may also use any of these keys: years, months, weeks, days, hours, minutes and seconds.</p>
<p>You can read all about expires headers by reading Yahoo!’s <a href="http://developer.yahoo.com/performance/rules.html#expires" title="Yahoo! Best Practices for Speeding Up Your Web Site Guide" target="_blank" rel="nofollow">Best Practices for Speeding Up Your Web Site</a> guide.</p>
<p>Alternatively, read the <a href="http://httpd.apache.org/docs/2.0/mod/mod_expires.html" title="Apache mod_expires documentation" target="_blank" rel="nofollow">Apache mod_expires documentation</a>.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6475233631580417";
/* 468x60 Basic */
google_ad_slot = "7117418273";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwhatley.co.uk/how-to-set-an-expires-header-in-apache/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Using Ant with Eclipse</title>
		<link>http://www.simonwhatley.co.uk/using-ant-with-eclipse</link>
		<comments>http://www.simonwhatley.co.uk/using-ant-with-eclipse#comments</comments>
		<pubDate>Tue, 06 Jan 2009 11:16:44 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache Ant]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[build.xml]]></category>
		<category><![CDATA[CFEclipse]]></category>
		<category><![CDATA[Click Import]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[dev server]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[extreme programming]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[lifecycle]]></category>
		<category><![CDATA[Martin Laine]]></category>
		<category><![CDATA[platform-independent tool]]></category>
		<category><![CDATA[software automation]]></category>
		<category><![CDATA[test-driven development]]></category>
		<category><![CDATA[unit testing frameworks]]></category>
		<category><![CDATA[web developers]]></category>
		<category><![CDATA[Web Server]]></category>
		<category><![CDATA[web server folder]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.simonwhatley.co.uk/?p=1552</guid>
		<description><![CDATA[If you're currently not using Eclipse as your development tool of choice, you certainly should be! Eclipse is an open source community whose projects are focused on building an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the lifecycle.]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re currently not using Eclipse as your development tool of choice, you certainly should be! Eclipse is an open source community whose projects are focused on building an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the lifecycle.</p>
<p>Eclipse started out as a Java <abbr title="Integrated Development Environment">IDE</abbr> and has continually grown from there. Plugins now include, amongst a plethora of others, the venerable Aptana, CFEclipse, SQL Explorer, Subclipse and, more recently, the Adobe-developed Flex Builder and ColdFusion-equivalent codenamed <q>Bolt</q>.</p>
<p>Apache Ant is a software tool for automating software build processes. It is implemented using the Java language, requires the Java platform, and was originally developed to automate the build of Java projects. However, since Ant was created as a simple, platform-independent tool, it can really be used to automate the build of anything you choose.</p>
<p>Ant uses <abbr title="eXtensible Markup Language">XML</abbr> to describe the build process and its dependencies, using a file commonly called <code>build.xml</code>. Using this file, Ant makes it trivial to integrate unit testing frameworks with the build process and has made it easy for web developers to adopt test-driven development, and even Extreme Programming.</p>
<p>Fortunately for us, if you download and run Eclipse, you already have Ant installed and so do not have any complex configuration to concern yourself with; well, at least initially.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6475233631580417";
/* 468x60 Basic */
google_ad_slot = "7117418273";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<h3>Setting Up Eclipse</h3>
<p>For the most part, Eclipse has all you need to get up and running with Ant pre-installed. However, most projects will include a release target which uses <abbr title="File Transfer Protocol">FTP</abbr> to upload the files to a live server. The <abbr title="File Transfer Protocol">FTP</abbr> ant task requires some extra libraries (.jar files):</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">commons-net-*.jar
jakarta-oro-*.jar</pre></div></div>

<p>(The library <a href="http://www.simonwhatley.co.uk/examples/ant/">files can be downloaded from here</a>).</p>
<p>Copy the files into the ant lib folder of your Eclipse install. The folder is commonly located here:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">C:\Program Files\Eclipse\plugins\org.apache.ant_*\lib</pre></div></div>

<p>(The asterix * refers to the Ant version).</p>
<p>Next, go to Window > Preferences and select Ant > Runtime. In the Classpath tab, select Ant Home Entries, click Add External JARs&#8230; and select the 2 files you copied to the ant lib folder.</p>
<h3>A Typical Ant Project Setup</h3>
<p>A project with ant build scripts should have the following within the repository:</p>
<ul>
<li>build.xml (the actual ant build script)</li>
<li>build.properties.template (a template for individual build.properties files)</li>
<li>an optional top level lib folder (containing jar files for external ant tasks)</li>
</ul>
<p>Examples of the <code>build.xml</code> and <code>build.properties.template</code> <a href="http://www.simonwhatley.co.uk/examples/ant/">files can be downloaded from here</a>.</p>
<h3>Create Your Own build.properties File</h3>
<p>Make a copy of the <code>build.properties.template</code> file (name it build.properties) and set the values to fit your local setup (in most cases, the only property you may want to change is <code>deploy.dir.local</code> which is the path to the site on your local machine).</p>
<p>This file should never be committed to the repository (the repository should be set to ignore it anyway).</p>
<h3>Basic Build Tasks</h3>
<p>The build file should have a <code>deploy.local</code> task. This task builds the project and copies it to your local webserver (the path to the web server folder will be defined in the <code>build.properties</code> file).</p>
<p>Most projects should also have a <code>deploy.dev</code> task to copy the latest work to the dev server so that other people can view it.</p>
<h3>Setting Up an Automatic Build</h3>
<p>To make things easy, you can set deploy.local to run every time you save a file. This is called an <q>automatic build</q>.</p>
<p>The process for setting up automatic build is quite convoluted. I&#8217;m not sure why but this is the best way I&#8217;ve found to make it work.</p>
<p><strong>Step 1: Add the build file to your ant view</strong></p>
<p>Click the add button and select the build.xml file from the project. You can also drag the build.xml file onto the ant view (To add the ant view to your perpective, go to Window > Show View > Other…)</p>
<p><strong>Step 2: Run as Ant Build</strong></p>
<p>In your ant view, right click the newly added build file and select Run As > Ant Build… In the dialog window, select the &#8216;Hide internal targets not selected for execution&#8217; option in the Targets tab. You can rename the builder in the box at the top of the window if you wish (I usually remove the trailing &#8216;build.xml&#8217;. Click Apply and Close.</p>
<p><strong>Step 3: Setup automatic build</strong></p>
<p>Right click on the project, select Properties, then Builders. Click Import. Before closing the screen, highlight the imported build and select edit. Go to the Targets tab select clean for &#8216;After a clean&#8217; and deploy.local for &#8216;Auto build&#8217;. Apply the changes and close.</p>
<p><strong>Step 4: Enable Auto Build</strong></p>
<p>Go to Project > Build Automatically</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6475233631580417";
/* 468x60 Basic */
google_ad_slot = "7117418273";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p><strong> Acknowledgment:</strong> Thanks should go to <a href="http://www.1pixelout.net/" title="1PixelOut: Martin Laine's online musings" target="_blank" rel="nofollow">Martin Laine</a> for his help and guidance which resulted in this article.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwhatley.co.uk/using-ant-with-eclipse/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Enabling Search Engine Safe URLs with Apache and htaccess</title>
		<link>http://www.simonwhatley.co.uk/enabling-search-engine-safe-urls-with-apache-and-htaccess</link>
		<comments>http://www.simonwhatley.co.uk/enabling-search-engine-safe-urls-with-apache-and-htaccess#comments</comments>
		<pubDate>Mon, 08 Dec 2008 15:57:15 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[All]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[ColdBox]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Fusebox]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[httpd.conf]]></category>
		<category><![CDATA[ISAPI]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[New Brunswick]]></category>
		<category><![CDATA[None]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[search engine]]></category>
		<category><![CDATA[search engine optimisation]]></category>
		<category><![CDATA[search engine robots]]></category>
		<category><![CDATA[search engine safe]]></category>
		<category><![CDATA[url]]></category>
		<category><![CDATA[URL rewriting]]></category>
		<category><![CDATA[USD]]></category>
		<category><![CDATA[web applications]]></category>

		<guid isPermaLink="false">http://www.simonwhatley.co.uk/?p=1635</guid>
		<description><![CDATA[An increasingly popular technique among websites and in particular, blogs, is the idea of making URLs search engine friendly, or safe, on the premise that doing so will help search engine optimisation. By removing the obscure query string element of a URL and replacing it with keyword rich alternatives, not only makes it more readable for a human being, but also the venerable robots that allow our page content to be found in the first place.]]></description>
			<content:encoded><![CDATA[<p>An increasingly popular technique among websites and in particular, blogs, is the idea of making <abbr title="Universal Resource Locator">URL</abbr>s search engine friendly, or safe, on the premise that doing so will help search engine optimisation. By removing the obscure query string element of a <abbr title="Universal Resource Locator">URL</abbr> and replacing it with keyword rich alternatives, not only makes it more readable for a human being, but also the venerable robots that allow our page content to be found in the first place.</p>
<p>For example, the following is WordPress&#8217; default URL configuration for a post:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">http://www.domain.com/?p=1635</pre></div></div>

<p>However, buy using a URL-rewriting available in the Apache webserver, we can achieve a far better result, such as the following:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">http://www.domain.com/search-engine-safe-urls</pre></div></div>

<p>NB. It is also possible to achieve a similar result with an <abbr title="Internet Server Application Programming Interface">ISAPI</abbr> rewrite for Microsoft&#8217;s <abbr title="Internet Information Server">IIS</abbr> webserver, but this topic will not be included in this post.</p>
<p>To get your website working with <abbr title="search engine safe">SES</abbr> <abbr title="Universal Resource Locator">URL</abbr>s you need to enable both the <code>mod_rewite</code> module and <code>AllowOverride</code> directive in the Apache configuration file.</p>
<p>Uncomment (remove #) from the following to enable the re-write rule:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">LoadModule rewrite_module modules/mod_rewrite.so</pre></div></div>

<p>Change the <code>AllowOverride</code> directive from none to all</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&lt;directory /&gt;
    Options FollowSymLinks
    AllowOverride all
    Order deny,allow
    Deny from all
&lt;/directory&gt;
&nbsp;
&lt;directory &quot;C:/WebRoot&quot;&gt;
    # Possible values for the Options directive are &quot;None&quot;, &quot;All&quot;,
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that &quot;MultiViews&quot; must be named *explicitly* --- &quot;Options All&quot;
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks
&nbsp;
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be &quot;All&quot;, &quot;None&quot;, or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All
&nbsp;
    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all
&lt;/directory&gt;</pre></div></div>

<p>On Apache webservers, <code>.htaccess</code> (hypertext access) is the default name of directory-level configuration files. An <code>.htaccess</code> file is placed in a particular directory, and the directives in the <code>.htaccess</code> file apply to that directory, and all its subdirectories. It provides the ability to customize configuration for requests to the particular directory. In our case, enabling search engine safe (<abbr title="search engine safe">SES</abbr>) <abbr title="Universal Resource Locator">URL</abbr>s.</p>
<p>By setting the <code>AllowOverride</code> directive to <q>All</q> in effect defers configuration settings to the <code>.htaccess</code> file.</p>
<p>An example <code>.htaccess</code> file could include the following code to rewrite the URLs:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]</pre></div></div>

<p>Search engine friendly <abbr title="Universal Resource Locator">URL</abbr>s are implemented with Rewrite engines. The rewrite engine modifies the <abbr title="Universal Resource Locator">URL</abbr> based upon a number of rewrite conditions and rules.</p>
<p>The <code>RewriteBase</code> directive explicitly sets the base <abbr title="Universal Resource Locator">URL</abbr> for per-directory rewrites. The <code>RewriteCond</code> directive defines a rule condition, so in this case handling missing files or directories. Finally, the <code>RewriteRule</code> directive is the real rewriting workhorse. In this example, we&#8217;re getting everything in the <abbr title="Uniform Resource Identifier">URI</abbr> &#8212; i.e. not including the protocol (HTTP/S) and domain name &#8212; based upon a regular expression. This is then appended to the default file reference &#8212; index.php &#8212; as a <a href="http://www.regular-expressions.info/brackets.html" title="Regular Expression: back references" target="_blank" rel="nofollow">back reference</a>. The <code>[L,QSA]</code> refers to the rule being the last rule and append any query string parameters to the default file. It is important to note that this is all done on the server side, the user will never see the website address changing in the browser&#8217;s address bar. Furthermore, simply transposing the index.php filename with your default file name &#8212; e.g. index.cfm, default.aspx &#8212; will have the same result. Indeed, the above rewrite rules are becoming a de-facto standard for web applications.</p>
<p>To fully understand <code>mod_rewrite</code> rules above, look at the <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html" title="Apache mod_rewrite documentation" target="_blank" rel="nofollow">Apache mod_rewrite documentation</a>.</p>
<p>Once you have your <abbr title="Search Engine Safe">SES</abbr> functionality in place on the webserver, it is then the responsibility of your application framework to understand the <abbr title="Universal Resource Locator">URL</abbr> construction and handle it accordingly. Fortunately, frameworks such as <a href="http://www.coldboxframework.com" title="ColdBox Framework" target="_blank" rel="nofollow">ColdBox</a> and <a href="http://www.fusebox.org" title="Fusebox Framework" target="_blank" rel="nofollow" >Fusebox</a> for ColdFusion, <a href="http://framework.zend.com" title="Zend PHP framework" target="_blank" rel="nofollow">Zend</a> and <a href="http://www.symfony-project.com" title="Symfony PHP fraemwork" target="_blank" rel="nofollow">Symfony</a> for <abbr title="PHP Hypertext Precursor">PHP</abbr>, all contain functionality to do this, but that is the subject of an entirely different post.</p>
<p>Users of web applications prefer short, neat <abbr title="Universal Resource Locator">URL</abbr>s to raw query string parameters. A concise <abbr title="Universal Resource Locator">URL</abbr> is easy to remember, and less time-consuming to type in. If the <abbr title="Universal Resource Locator">URL</abbr> can be made to relate clearly to the content of the page, then errors are not only less likely to happen, but our good friends the search engine robots are able to draw a stronger assumption of the pages&#8217; relevance and content.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6475233631580417";
/* 468x60 Basic */
google_ad_slot = "7117418273";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwhatley.co.uk/enabling-search-engine-safe-urls-with-apache-and-htaccess/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Apache Installation &#8211; Problems with Skype</title>
		<link>http://www.simonwhatley.co.uk/apache-installation-problems-with-skype</link>
		<comments>http://www.simonwhatley.co.uk/apache-installation-problems-with-skype#comments</comments>
		<pubDate>Thu, 21 Feb 2008 22:29:33 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[Microsoft Vista]]></category>
		<category><![CDATA[Microsoft Windows]]></category>
		<category><![CDATA[skype]]></category>
		<category><![CDATA[Windows Vista]]></category>

		<guid isPermaLink="false">http://www.simonwhatley.co.uk/?p=399</guid>
		<description><![CDATA[When trying to install the latest version of Apache on my development machine, I was presented with a nasty error at the end of the installation, that I initially thought related to a previous IIS installation.]]></description>
			<content:encoded><![CDATA[<p>When trying to install the latest version of Apache on my development machine, I was presented with the following error at the end of the installation:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Only one usage of each socket address (protocol/network address/port) is normally pemitted.
make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to openlogs
Note the errors or messages above, and press the &lt; ESC &gt; key to exit.</pre></div></div>

<p>Initially I thought it was a problem associated with Windows Vista (yes my development machine is a Vista PC!) and the previously installed <acronym title="Internet Information Services">IIS</acronym>. However, after a lot of deliberating and Google searches, it appears that Skype was the culprit. Skype listens on port 80 and 443 for incoming requests. So to solve the problem I simply closed down Skype and re-installed Apache. As Apache was setup as a Windows service, no conflicts subsequently arise with Skype as Apache will start using the ports before Skype.</p>
<p>There is a setting in Skype under Tools > Options > Advanced > Connection called &#8220;Use port 80 and 443 as alternatives for incoming connections&#8221;. This is checked by default. Uncheck this to prevent conflicts with Apache.</p>
<p><img src='http://www.simonwhatley.co.uk/blog/wp-content/uploads/2008/02/skype-advanced-options.JPG' alt='Skype Advanced Connection Options' /></p>
<p>The Key Point: Stop Skype before installing Apache.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6475233631580417";
/* 468x60 Basic */
google_ad_slot = "7117418273";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwhatley.co.uk/apache-installation-problems-with-skype/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP.ini Permission Problems on Windows Vista</title>
		<link>http://www.simonwhatley.co.uk/phpini-permission-problems-on-windows-vista</link>
		<comments>http://www.simonwhatley.co.uk/phpini-permission-problems-on-windows-vista#comments</comments>
		<pubDate>Sun, 17 Feb 2008 22:28:41 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[administrator]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[configuring]]></category>
		<category><![CDATA[difficulties]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[Microsoft Vista]]></category>
		<category><![CDATA[Microsoft Windows]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[paths]]></category>
		<category><![CDATA[permissions]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[problems]]></category>
		<category><![CDATA[Rob Douglas]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[solutions]]></category>
		<category><![CDATA[solving]]></category>
		<category><![CDATA[Vista]]></category>
		<category><![CDATA[Windows Vista]]></category>

		<guid isPermaLink="false">http://www.simonwhatley.co.uk/?p=398</guid>
		<description><![CDATA[Installing PHP is a relatively simple task one would think. Indeed it is simple, but configuring the php.ini isn't; at least not so on Windows Vista! It is infuriating when such a relatively simple task is made inordinately complicated because of the nuances of Vista permissions. What started out as a 5 minute task took a significant number of hours searching for a suitable answer on Google, and not only by myself.]]></description>
			<content:encoded><![CDATA[<p>Installing PHP is a relatively simple task one would think. Indeed it is simple, but configuring the php.ini isn&#8217;t; at least not so on Windows Vista! It is infuriating when such a relatively simple task is made inordinately complicated because of the nuances of Vista permissions. What started out as a 5 minute task took a significant number of hours searching for a suitable answer on Google, and not only by myself.</p>
<p>The task I was trying to achieve was the installation of development versions of <a href="http://wordpress.org" title="WordPress" rel="nofollow">WordPress</a>, <a href="http://drupal.org" title="Drupal" rel="nofollow">Drupal</a>, <a href="http://www.mediawiki.org" title="MediaWiki" rel="nofollow">MediaWiki</a> and <a href="http://moodle.org" title="Moodle" rel="nofollow">Moodle</a>, all of which would require a MySQL database. Trying to load the MySQL extension should have been a simple case of uncommenting the line in the php.ini and restarting the Apache service. With Vista, this was certainly not the case.</p>
<p>I set up a very simple page detailing the <acronym title="PHP: Hypertext Preprocessor">php</acronym> configuration in an index.php file:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php <span style="color: #990000;">phpinfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This showed me the default configuration path of my php.ini and extensions directory, amongst a whole host of other information.</p>
<p>In both cases the paths were incorrect. First and foremost the configuration file path stated <code>C:\Windows</code> when in fact I had installed it in the root (<code>C:\PHP5</code>). So, although I was amending the php.ini file with the correct detail, Vista was using the default values. If there is no php.ini file in Windows, then you&#8217;ll continue banging your head against a brick wall.</p>
<p>The problems didn&#8217;t stop there. Moving the php.ini file to the Windows directory under Vista isn&#8217;t a simple copy and paste task. You need to be administrator. But Vista&#8217;s administrator priviledges are more pseudo than actual! In order to amend and save the php.ini file in the Windows directory, you must run Notepad as administrator and save the file as such. Voila! Everything then works. The <code>phpinfo()</code> function returned the correct installation detail and I could continue with the job I was meant to be doing.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6475233631580417";
/* 468x60 Basic */
google_ad_slot = "7117418273";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>PS. Thanks to <a href="http://www.anucreative.com" title="Rob Douglas" rel="nofollow">Rob Douglas</a> for his help.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonwhatley.co.uk/phpini-permission-problems-on-windows-vista/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

