<?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>Project 2061 Techlog &#187; System Administration</title> <atom:link href="http://techlog.p2061.org/category/system-administration/feed/" rel="self" type="application/rss+xml" /><link>http://techlog.p2061.org</link> <description>Blogging from Project 2061 technology group</description> <lastBuildDate>Tue, 06 Sep 2011 14:49:39 +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>WP redirects confuse IE</title><link>http://techlog.p2061.org/2011/05/27/wp-redirects-confuse-ie/</link> <comments>http://techlog.p2061.org/2011/05/27/wp-redirects-confuse-ie/#comments</comments> <pubDate>Fri, 27 May 2011 16:34:43 +0000</pubDate> <dc:creator>bsweeney</dc:creator> <category><![CDATA[System Administration]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[bp2.x]]></category> <category><![CDATA[ie]]></category> <category><![CDATA[wp3.0.x]]></category> <guid
isPermaLink="false">http://techlog.p2061.org/?p=491</guid> <description><![CDATA[Some users were having problems on a community site that was implemented using WordPress+BuddyPress. After some testing the issue involved users visiting the site with Internet Explorer (IE). These users were receiving error pages instead of site content. Other web browsers did not have similar issues. The cause of the problem turns out to be [...]]]></description> <content:encoded><![CDATA[<p>Some users were having problems on a community site that was implemented using WordPress+BuddyPress. After some testing the issue involved users visiting the site with Internet Explorer (IE). These users were receiving error pages instead of site content. Other web browsers did not have similar issues.</p><p>The cause of the problem turns out to be a confluence of issues:</p><ul><li> The site is hosted on a Windows+IIS server, a rare platform for WordPress (and even more so for BuddyPress) and one that probably doesn&#8217;t receive full attention during quality assurance testing.</li><li>How WordPress performs redirects on IIS is a bit quirky. BuddyPress issues a lot of redirects so this redirect quirk comes into play quite often. The issue is that when WordPress needs to perform a redirect on IIS it returns a &#8220;refresh&#8221; header pointing to the new page rather than a &#8220;location&#8221; header.</li><li>IE&#8217;s attempt to make the Internet more friendly; specifically IE&#8217;s use of &#8220;friendly error pages.&#8221; These friendly error pages replace the content delivered by the server (if that content falls below a certain size in KB).</li></ul><p>Normally none of these issue are a problem by themselves and a web browser (including IE) will load the page indicated by the redirect. However, all three of the above issues taken together result in a situation where IE never sees the header refresh and so doesn&#8217;t redirect the user to the correct location.</p><p><a
title="BuddyPress.org | Community/groups | How-To and Troubleshooting | Forum: &quot;Friendly HTTP Error Messages&quot; causes 404" href="http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/friendly-http-error-messages-causes-404/">The fix is fairly simple</a>: change the headers that WordPress sends to include the standard &#8220;location&#8221; header. To do this you modify wordpress/wp-includes/pluggable.php@wp_redirect() so that it reads as follows (line 14 is new):</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> wp_redirect<span style="color: #009900;">&#40;</span><span style="color: #000088;">$location</span><span style="color: #339933;">,</span> <span style="color: #000088;">$status</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">302</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$is_IIS</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$location</span> <span style="color: #339933;">=</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_redirect'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$location</span><span style="color: #339933;">,</span> <span style="color: #000088;">$status</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$status</span> <span style="color: #339933;">=</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_redirect_status'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$status</span><span style="color: #339933;">,</span> <span style="color: #000088;">$location</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$location</span> <span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">// allows the wp_redirect filter to cancel a redirect</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$location</span> <span style="color: #339933;">=</span> wp_sanitize_redirect<span style="color: #009900;">&#40;</span><span style="color: #000088;">$location</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$is_IIS</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Refresh: 0;url=<span style="color: #006699; font-weight: bold;">$location</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: <span style="color: #006699; font-weight: bold;">$location</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #000088;">$status</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">php_sapi_name</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'cgi-fcgi'</span> <span style="color: #009900;">&#41;</span>
			status_header<span style="color: #009900;">&#40;</span><span style="color: #000088;">$status</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// This causes problems on IIS and some FastCGI setups</span>
		<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: <span style="color: #006699; font-weight: bold;">$location</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #000088;">$status</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div> ]]></content:encoded> <wfw:commentRss>http://techlog.p2061.org/2011/05/27/wp-redirects-confuse-ie/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>What file was that in?</title><link>http://techlog.p2061.org/2011/05/06/what-file-was-that-in/</link> <comments>http://techlog.p2061.org/2011/05/06/what-file-was-that-in/#comments</comments> <pubDate>Fri, 06 May 2011 19:13:23 +0000</pubDate> <dc:creator>bsweeney</dc:creator> <category><![CDATA[System Administration]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[cmd]]></category> <category><![CDATA[search]]></category> <guid
isPermaLink="false">http://techlog.p2061.org/?p=506</guid> <description><![CDATA[One of the more annoying things about coding is finding the right file. Or, even worse, finding a file you didn&#8217;t know you needed to look at. Especially when the number of files you&#8217;re parsing is in the thousands. If you&#8217;re on Windows the built-in search can help, but you never know if all the [...]]]></description> <content:encoded><![CDATA[<p>One of the more annoying things about coding is finding the right file. Or, even worse, finding a file you didn&#8217;t know you needed to look at. Especially when the number of files you&#8217;re parsing is in the thousands. If you&#8217;re on Windows the built-in search can help, but you never know if all the files in the target directory have been indexed.</p><p>Luckily, one of the nice things about coding is that you&#8217;re often dealing with plain text files. And you are typically searching for a particular string. As they say, there&#8217;s an app for that. Both *nix and Windows are capable of searching through the contents an entire hierarchy of files using command-line programs. Each OS has a variety of commands that can do the job, but I&#8217;ll highlight the two I use most often here.</p><p>In Windows you would use <a
title="Microsoft DOS findstr command (computerhope.com)" href="http://www.computerhope.com/findstr.htm"><code>findstr.exe</code></a>, and it&#8217;s as simple as running the following from the containing directory:</p><div
class="wp_syntax"><div
class="code"><pre class="cmd" style="font-family:monospace;">findstr.exe /MIS &quot;searchtext&quot; filetype</pre></div></div><p>On *nix systems the <a
title="Linux / Unix grep command (computerhope.com)" href="http://www.computerhope.com/unix/ugrep.htm"><code>grep</code></a> command is your friend:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-lr</span> <span style="color: #ff0000;">&quot;searchtext&quot;</span> filetype</pre></div></div><p>Of course, a quick google search will get you all the help you need in refining your search.</p> ]]></content:encoded> <wfw:commentRss>http://techlog.p2061.org/2011/05/06/what-file-was-that-in/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Executable blocking on Windows 2003</title><link>http://techlog.p2061.org/2010/12/23/blocked/</link> <comments>http://techlog.p2061.org/2010/12/23/blocked/#comments</comments> <pubDate>Thu, 23 Dec 2010 18:40:29 +0000</pubDate> <dc:creator>bsweeney</dc:creator> <category><![CDATA[System Administration]]></category> <category><![CDATA[error]]></category> <category><![CDATA[fail]]></category> <category><![CDATA[security]]></category> <category><![CDATA[windows]]></category> <guid
isPermaLink="false">http://techlog.p2061.org/?p=388</guid> <description><![CDATA[I was recently attempting to install PHP using an installer (MSI) I downloaded to my local workstation and copied to one of our servers. When I attempted to run the installer I received the following inscrutable warning: Thanks, Windows, that&#8217;s helpful. I had no idea what was happening, especially since I was logged in as [...]]]></description> <content:encoded><![CDATA[<p>I was recently attempting to install PHP using an installer (MSI) I downloaded to my local workstation and copied to one of our servers. When I attempted to run the installer I received the following inscrutable warning:</p><p
style="text-align: center;"><a
href="http://techlog.p2061.org/wp-content/uploads/2010/12/blocked1.png" rel="lightbox[388]"><img
class="size-full wp-image-390 aligncenter" title="Pop-up message produced when you attempt to execute a blocked executable" src="http://techlog.p2061.org/wp-content/uploads/2010/12/blocked1.png" alt="Windows cannot access the specific device, path, or file. You may not have the appropriate permissions to access the item." width="457" height="85" /></a></p><p>Thanks, Windows, that&#8217;s helpful. I had no idea what was happening, especially since I was logged in as an administrator with full control of the file.</p><p>As usual, the web was my friend in solving the problem. Windows 2003 Server has a security feature where executables copied from remote systems are blocked for execution unless allowed by an administrator. The feature appears to have been present for a while (since SP2?), but I don&#8217;t recall running into it before. As mentioned above, the file in my case was copied from my workstation over SMB; I don&#8217;t know if other transfer methods are also affected. I don&#8217;t have a problem with the feature, but I do have a problem with how it&#8217;s implemented. An indication in the pop-up of why the file could not be accessed would have resulted in a resolution of seconds not &#8230; er &#8230; minutes.</p><p>The resolution is simple enough, go into the properties for the file and you&#8217;ll see at the bottom a security warning and a button that allows you to unblock the file.</p><p
style="text-align: center;"><a
href="http://techlog.p2061.org/wp-content/uploads/2010/12/properties.png" rel="lightbox[388]"><img
class="aligncenter" title="File properties showing the added &quot;security&quot; information for a blocked executable" src="http://techlog.p2061.org/wp-content/uploads/2010/12/properties.png" alt="" width="367" height="502" /></a></p><p>Click the &#8220;Unblock&#8221; button and you can execute the file as you normally would.</p><p><strong>References:</strong></p><ul><li><a
href="http://dobrzanski.net/2007/11/28/windows-2003-problem-with-running-exe-files/">Windows 2003: problem with running exe files | Blinded by the lights</a></li><li>&#8220;<a
href="http://www.chicagotech.net/netforums/viewtopic.php?t=2510">Windows cannot access the specified device, path, or file</a>&#8221; thread from the chicagotech.net forums</li></ul> ]]></content:encoded> <wfw:commentRss>http://techlog.p2061.org/2010/12/23/blocked/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>suhosin to [internal web app]: you talk too much</title><link>http://techlog.p2061.org/2010/12/03/suhosin-to-internal-web-app-you-talk-too-much/</link> <comments>http://techlog.p2061.org/2010/12/03/suhosin-to-internal-web-app-you-talk-too-much/#comments</comments> <pubDate>Fri, 03 Dec 2010 16:13:07 +0000</pubDate> <dc:creator>bsweeney</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[System Administration]]></category> <category><![CDATA[php]]></category> <category><![CDATA[security]]></category> <category><![CDATA[suhosin]]></category> <guid
isPermaLink="false">http://techlog.p2061.org/?p=375</guid> <description><![CDATA[Following up on my earlier post, I&#8217;ve had to make some further configuration adjustments to avoid suhosin-related restrictions in one of our custom web applications. This particular application has a function that generates a summary of data from student assessments. The summaries can be generated based on groupings of packets and items. Depending on the [...]]]></description> <content:encoded><![CDATA[<p>Following up on my <a
href="http://techlog.p2061.org/2010/11/05/suhosin-gives-wordpress-the-smackdown/">earlier post</a>, I&#8217;ve had to make some further configuration adjustments to avoid suhosin-related restrictions in one of our custom web applications. This particular application has a function that generates a summary of data from student assessments. The summaries can be generated based on groupings of packets and items. Depending on the filtering parameters selected there can be a fairly large number of packets and items. Not all of the packets necessarily contain the items of interest, but it&#8217;s always easier to select all if you want an overall summary of item performance.</p><p>I recently noticed the following alert in the system log:</p><blockquote><p>ALERT &#8211; configured POST variable limit exceeded &#8211; dropped variable &#8216;included_packet_ids[]&#8216; (attacker <em>USER_IP_ADDRESS</em>, file <em>REPORT_FILTERING_PAGE</em>)</p></blockquote><p>One of the reasons I use POST variables on this page is to avoid the relatively small data size limit of GET. Suhosin adds additional limits, including in the number of times you can reference an individual variable.  Our limit was set at 1000, meaning there were over 1000 packets selected. This points to a need to adjust how the filter &#8220;selects all&#8221; &#8230; but for now I&#8217;ve adjusted the suhosin limit upward by modifying the <code>suhosin.post.max_vars</code> setting.</p><p><strong>References:</strong></p><ul><li><a
href="http://blog.motane.lu/2009/09/15/alert-configured-post-variable-limit-exceeded/">ALERT &#8211; configured POST variable limit exceeded ::Suhosin configuration blocks script | Tudor Barbu&#8217;s professional blog</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://techlog.p2061.org/2010/12/03/suhosin-to-internal-web-app-you-talk-too-much/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>suhosin to WordPress: go on a diet</title><link>http://techlog.p2061.org/2010/11/05/suhosin-to-wordpress-go-on-a-diet/</link> <comments>http://techlog.p2061.org/2010/11/05/suhosin-to-wordpress-go-on-a-diet/#comments</comments> <pubDate>Fri, 05 Nov 2010 20:45:46 +0000</pubDate> <dc:creator>bsweeney</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[System Administration]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[php]]></category> <category><![CDATA[security]]></category> <category><![CDATA[suhosin]]></category> <guid
isPermaLink="false">http://techlog.p2061.org/?p=352</guid> <description><![CDATA[We were seeing a lot of suhosin alerts in the system messages log of the type: ALERT &#8211; script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker SERVER_IP_ADDRESS, file WP_MAIN_ADMIN_PAGE, line 96) The source of the issue is WordPress. The application is trying to raise the memory limit and [...]]]></description> <content:encoded><![CDATA[<p>We were seeing a lot of suhosin alerts in the system messages log of the type:</p><blockquote><p>ALERT &#8211; script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker <em>SERVER_IP_ADDRESS</em>, file <em>WP_MAIN_ADMIN_PAGE</em>, line 96)</p></blockquote><p>The source of the issue is WordPress. The application is trying to raise the memory limit and suhosin won&#8217;t let it. Apparently <a
href="http://hakre.wordpress.com/2010/08/17/mysteries-about-the-wordpress-memory-limit/">WordPress will try to set a 256MB memory limit</a> before executing certain functions. The necessity of adjusting this setting seems questionable to me, but I also understand that it&#8217;s often better to play it safe when developing software for public consumption.</p><p>I don&#8217;t particularly like applications attempting to specify their own resource usage in a web environment. In my mind applications should specify a required/recommended memory limit in the system requirements and stay away from adjusting this setting behind-the-scenes. Tell me during setup if the current setting may result in non-optimal performance or even a halt in script execution. That&#8217;s not how it&#8217;s done here, but really no harm is done in the long run beyond the annoyance of suhosin throwing errors at the system logs.</p><p>There are two easy fixes to the problem:</p><ol><li>Set the PHP memory limit to 256MB</li><li>Modify the suhosin.memory_limit parameter to 256MB</li></ol><p>In our particular situation it&#8217;s just as easy to set the PHP memory limit. There&#8217;s always a risk of overloading the physical resources, but this site receives little enough traffic that I&#8217;m not concerned about the right confluence of request occurring to cause a crash.</p><p><strong>References:</strong></p><ul><li><a
href="http://hakre.wordpress.com/2010/08/17/mysteries-about-the-wordpress-memory-limit/">Mysteries about the WordPress Memory Limit | hakre on wordpress</a></li><li><a
href="http://www.hardened-php.net/suhosin/configuration.html#suhosin.memory_limit">Hardened-PHP Project &#8211; PHP Security &#8211; Configuration</a></li></ul><div
id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;">ALERT – script tried to increase memory_limit to 268435456 bytes which is above the allowed value</div> ]]></content:encoded> <wfw:commentRss>http://techlog.p2061.org/2010/11/05/suhosin-to-wordpress-go-on-a-diet/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Rewriting URLs on IIS6</title><link>http://techlog.p2061.org/2010/03/05/rewriting-urls-on-iis6/</link> <comments>http://techlog.p2061.org/2010/03/05/rewriting-urls-on-iis6/#comments</comments> <pubDate>Fri, 05 Mar 2010 23:27:57 +0000</pubDate> <dc:creator>bsweeney</dc:creator> <category><![CDATA[System Administration]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[CakePHP]]></category> <category><![CDATA[iirf]]></category> <category><![CDATA[mod_rewrite]]></category> <guid
isPermaLink="false">http://techlog.p2061.org/?p=305</guid> <description><![CDATA[One of the nice things about CakePHP is that it attempts to make a site more friendly to the average web site visitor by creating easier-to-remember URLs. There are a few techniques that CakePHP uses, but for the sake of this conversation we&#8217;ll focus on one way in particular: apache&#8217;s mod_rewrite functionality. Using mod_rewrite, URLs [...]]]></description> <content:encoded><![CDATA[<p>One of the nice things about CakePHP is that it attempts to make a site more friendly to the average web site visitor by creating easier-to-remember URLs. There are a few techniques that CakePHP uses, but for the sake of this conversation we&#8217;ll focus on one way in particular: apache&#8217;s mod_rewrite functionality. Using mod_rewrite, URLs that would normally include the controller file (index.php) and a querystring can be rewritten as a simple file path.</p><p>Microsoft doesn&#8217;t include mod_rewrite-style functionality in IIS by default, though it has created an <a
href="http://www.iis.net/expand/URLRewrite">extension for IIS7</a>. Since we are currently using IIS6 the extension isn&#8217;t an option for us. Fortunately there are a few other options available, including an open-source project called <a
href="http://www.codeplex.com/IIRF">Ionics Isapi Rewrite Filter</a> (IIRF). IIRF is an ISAPI filter that is very similar to mod_rewrite in terms of functionality. After some testing I&#8217;ve found this filter works almost perfectly for enabling CakePHP&#8217;s friendly URLs.</p><p><strong>Getting Started</strong></p><p>Installation is painless and requires only a few steps. The following is based on the IIRF 2.0.1.15 release which does not include an installer:</p><ol><li>Extract the files from the IIRF archive to a folder on the server.</li><li>Open the properties of the IIS root &#8220;Web Sites&#8221; folder or the specific site that needs IIRF.</li><li>In the &#8220;ISAPI Filters&#8221; tab create a new entry for IIRF; name the new filter (e.g. &#8220;IIRF&#8221;); specify the IIRF DLL located with the extracted IIRF files at \bin\IIRF.dll.</li><li>Ensure that the IIS user has read/execute access to the IIRF DLL and read/write access to any directories that will be used for logging.</li><li>Restart IIRF.</li></ol><p>IIRF should now be installed, but I&#8217;ve found that sometimes the filter won&#8217;t appear to be active in the &#8220;ISAPI Filters&#8221; tab until it has been used the first time. To enable IIRF all you have to do is create a file called IIRF.ini and place it in the web site root folder or in the root of a virtual directory. This file contains any local configuration directives (such as log directory) and URL rewriting rules.</p><p><strong>The obligatory gotcha</strong></p><p>I mentioned before that the filter works <em>almost</em> perfectly. The only situation where I&#8217;ve had problems up to now is if the URL contains one or more space characters. The IIRF log indicates that a URL with a space is being parsed correctly and returning a valid URL. And yet the web server reports a 404 error.</p><p>I&#8217;ve only done testing when the final URL references a physical file, but based on a conversation in the support forum I suspect this problem also affects parameters in the querystring. I haven&#8217;t yet had a chance to fully investigate the issue, so I don&#8217;t have a  work-around yet when the issue affects physical files. There does, however, appear to be a work-around for spaces in the querystring.</p><p>For now I have decided to ensure that any URLs parsed by IIRF that will point to a physical file/directory does not contain spaces.</p><p><strong>References</strong></p><p>CakePHP usage:</p><ul><li><a
href="http://iirf.codeplex.com/Thread/View.aspx?ThreadId=100341">CakePHP, IIRF REQUEST_FILENAME problem</a></li><li><a
href="http://techlog.p2061.org/wp-content/uploads/2010/03/iirf.ini_.txt">Sample IIRF.ini for CakePHP  installation</a></li></ul><p>Space-in-URL problems:</p><ul><li><a
href="http://iirf.codeplex.com/Thread/View.aspx?ThreadId=66377">Url rewrite and whitespaces</a></li><li><a
href="http://iirf.codeplex.com/Thread/View.aspx?ThreadId=203696">Space character in URL: rewrite appears correct, 404 returned</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://techlog.p2061.org/2010/03/05/rewriting-urls-on-iis6/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Subversion and Third-Party Code</title><link>http://techlog.p2061.org/2009/05/08/subversion-and-third-party-code/</link> <comments>http://techlog.p2061.org/2009/05/08/subversion-and-third-party-code/#comments</comments> <pubDate>Fri, 08 May 2009 22:28:55 +0000</pubDate> <dc:creator>bsweeney</dc:creator> <category><![CDATA[System Administration]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[subversion]]></category> <guid
isPermaLink="false">http://techlog.p2061.org/?p=137</guid> <description><![CDATA[Often in the course of developing a project it is desirable to use code from a  third party. The main benefit, of course, is being able to add functionality without developing that functionality from scratch. Some third-party projects we have used in the past include FCKEditor (now CKEditor), the Yahoo! User Interface library, and, more [...]]]></description> <content:encoded><![CDATA[<p>Often in the course of developing a project it is desirable to use code from a  third party. The main benefit, of course, is being able to add functionality without developing that functionality from scratch. Some third-party projects we have used in the past include FCKEditor (now <a
href="http://ckeditor.com/">CKEditor</a>), the <a
href="http://developer.yahoo.com/yui/">Yahoo! User Interface library</a>, and, more recently, the <a
href="http://cakephp.org/">CakePHP framework</a>.</p><p>When our code is maintained in a subversion repository there are two options for including third-party code: <em>externals</em> and <em>vendor branches</em>.<span
id="more-137"></span></p><p><strong>Externals</strong></p><p>For third-party code that will require little modification an externals property definition is preferred. Subversion externals are pointers to subversion sources outside the current path (either within the current repository or that are stored in entirely different repositories). Whenever a copy of our own project is checked out from the repository the third-party code is also checked out. One benefit of this approach is that a local copy of the third-party code does not have to be maintained. If an update to third-party code is available you only need to update the externals reference to the third-party repository.</p><p>For example, we want to add an externals definition for FCKEditor to our project. For the sake of this example we&#8217;ll use the 2.6.4-tagged version of FCKEditor and we&#8217;ll link this to the /includes/fckeditor path of our project. The steps are as follows:</p><ol><li>Ensure that /includes/fckeditor <em>does not exist</em>;</li><li>From the root of the working copy of the project run the following command:<div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> propset <span style="color: #c20cb9; font-weight: bold;">svn</span>:externals <span style="color: #ff0000;">'fckeditor http://svn.fckeditor.net/FCKeditor/tags/2.6.4'</span> includes</pre></div></div></li><li>Update the local working copy of the project</li></ol><p>That&#8217;s all there is to it.</p><p>When using externals I recommend that we only point to stable (tagged) versions of third-party projects. By pointing to a stable version we can test for bugs and for compatibility between our code and the third-party code prior to implementing updates on our own systems.</p><p><strong>Vendor Branches</strong></p><p>Vendor branches are locally-maintained copies of third-party code. Vendor branches are treated much like any project developed in-house. Using vendor branches is less desirable mainly due to the extra work required to update the code in the repository when significant additions and deletions have been made by the third-party. However, it is advisable to use a vendor branch when third-party code will require significant modification in order to be useful in own project.</p><p>To set up a vendor branch, first create a new project in the subversion repository as described in the post <a
href="http://techlog.p2061.org/2008/05/21/using-svn-for-application-deployment/">Using Subversion for Application Development and Deployment</a>. Note that it is standard to place vendor branches in a subdirectory of the &#8220;/vendor&#8221; directory of the repository. Once this is done we can tag stable versions and create branches just as we do with any other project in the repository. To add the vendor branch to another project within our repository I would recommend using an externals link much as we would for any third-party code. This should ease maintenance as the code is updated.</p><p>When third-party code is updated there are two methods you can use to update the vendor branch. The first method is best used when there are only a few files added to or removed from the third-party code. In this situation you can manually update a working copy of the trunk with the new release and commit the modifications. Any in-house changes to the code will have to be re-created (either by editing the code again or merging with an older branch).</p><p>When a significant number of file changes have been made to the third-party code it&#8217;s easiest to use svn_load_dirs.pl. This file will perform all the operations of adding, removing, and updating the files in the repository. And with the -t option you can automatically create a tagged (stable) version. For example, to update a vendor branch of the Yahoo! UI Library to version 2.6.0 you would issue the following command:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">svn_load_dirs.pl <span style="color: #660033;">-t</span> tags<span style="color: #000000; font-weight: bold;">/</span>2.6.0 <span style="color: #c20cb9; font-weight: bold;">svn</span>+<span style="color: #c20cb9; font-weight: bold;">ssh</span>:<span style="color: #000000; font-weight: bold;">//</span>svnrepo<span style="color: #000000; font-weight: bold;">/</span>vendor<span style="color: #000000; font-weight: bold;">/</span>yui trunk <span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>yui-<span style="color: #000000;">2</span>_6_0</pre></div></div><p>There are four parts to this command:</p><ul><li><code>-t tags/2.6.0</code> : creates a tagged version of the imported code</li><li><code>svn+ssh://svnrepo/vendor/yui</code> : the location of the vendor branch</li><li><code>trunk</code> : the subdirectory of the vendor branch where the updated code should be imported</li><li><code>/src/yui-2_6_0</code> : the path to the updated YUI library code downloaded from the YUI site</li></ul><p>Once you&#8217;ve executed this command you would continue with modification of the vendor branch just as you would if you had updated it manually.</p><p><strong>Wrap-up</strong></p><p>Working with both externals and vendor branches should ease the process of integrating third-party code. For more detailed information on these topics see the documentation from the SVN book.</p><ul><li><a
href="http://svnbook.red-bean.com/en/1.2/svn.advanced.externals.html">Version Control with Subversion: Externals Definitions</a></li><li><a
href="http://svnbook.red-bean.com/en/1.2/svn.advanced.vendorbr.html">Version Control with Subversion: Vendor Branches</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://techlog.p2061.org/2009/05/08/subversion-and-third-party-code/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Apache Log Format Update</title><link>http://techlog.p2061.org/2008/10/03/apache-log-format-update/</link> <comments>http://techlog.p2061.org/2008/10/03/apache-log-format-update/#comments</comments> <pubDate>Fri, 03 Oct 2008 18:57:45 +0000</pubDate> <dc:creator>bsweeney</dc:creator> <category><![CDATA[Apache]]></category> <category><![CDATA[System Administration]]></category> <guid
isPermaLink="false">http://techlog.p2061.org/?p=9</guid> <description><![CDATA[A note way past due. I updated the log format for flora.p2061.org (but not the other sites on flora). Some information is not included in the default &#8220;combined&#8221; format that could help with debugging (such as user cookies). I set up a new format that is similar to the IIS W3C extended format. Two values [...]]]></description> <content:encoded><![CDATA[<p>A note way past due.</p><p>I updated the log format for flora.p2061.org (but not the other sites on flora). Some information is not included in the default &#8220;combined&#8221; format that could help with debugging (such as user cookies). I set up a new format that is similar to the IIS W3C extended format. Two values not included that could prove useful are bytes received (%I) and bytes sent (%O). The logio_module has to be enabled to record this information. It would probably be worthwhile to add this functionality once we start placing more public content on the server. For now the following format suffices:</p><blockquote><p><code>#Fields: date    time    c-ip    cs-host    cs-version    cs-method    cs-uri-stem    cs-uri-query    cs(Referer)    cs(User-Agent)    cs(Cookie)    sc-status    time-taken<br
/> LogFormat "%{%Y-%m-%d    %H:%M:%S}t    %h    %V    %H    %m    %U    %q    %{Referer}i    %{User-Agent}i    %{Cookie}i    %&gt;s    %D" webapp</code></p></blockquote> ]]></content:encoded> <wfw:commentRss>http://techlog.p2061.org/2008/10/03/apache-log-format-update/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Playing nice with CPU usage</title><link>http://techlog.p2061.org/2008/08/14/playing-nice-with-cpu-usage/</link> <comments>http://techlog.p2061.org/2008/08/14/playing-nice-with-cpu-usage/#comments</comments> <pubDate>Thu, 14 Aug 2008 21:32:18 +0000</pubDate> <dc:creator>bsweeney</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[System Administration]]></category> <guid
isPermaLink="false">http://techlog.p2061.org/?p=86</guid> <description><![CDATA[I needed to do a mass resampling of around 280,000 images. There are a number of ways to do this, but I settled on doing it via PHP because the images are stored on our web server, the total size of the images is large (~10GB), and I didn&#8217;t want to kill my machine trying [...]]]></description> <content:encoded><![CDATA[<p>I needed to do a mass resampling of around 280,000 images. There are a number of ways to do this, but I settled on doing it via PHP because the images are stored on our web server, the total size of the images is large (~10GB), and I didn&#8217;t want to kill my machine trying to get it done.</p><p>PHP is ideal for a task such as this: parsing directories and subdirectories for images is easy; resampling using the built-in library (GD) is a breeze; specifying the destination as a subdirectory is simple. The one minus was processor usage. Performing image manipulation eats up the CPU in a big way.</p><p>Luckily linux systems have a built-in utility for addressing a situation like this: <code>nice</code>. <code>nice</code> will &#8220;run a program with modified scheduling priority.&#8221; I&#8217;m running the image manipulation script using the following command:</p><blockquote><p><code>nice --adjustment=19 php script.php</code></p></blockquote><p>If nothing else is going on the script will use whatever resources are available. When anything with a higher priority executes, that program will take precedence over the script with regard to system resources. The script should thus not affect the responsiveness of the web server. This is the reason I was searching for this kind of functionality.</p> ]]></content:encoded> <wfw:commentRss>http://techlog.p2061.org/2008/08/14/playing-nice-with-cpu-usage/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Using Subversion for Application Development and Deployment</title><link>http://techlog.p2061.org/2008/05/21/using-svn-for-application-deployment/</link> <comments>http://techlog.p2061.org/2008/05/21/using-svn-for-application-deployment/#comments</comments> <pubDate>Wed, 21 May 2008 20:25:00 +0000</pubDate> <dc:creator>bsweeney</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[System Administration]]></category> <guid
isPermaLink="false">http://techlog.p2061.org/?p=65</guid> <description><![CDATA[I recently wanted to update our install of WordPress to the latest version. WordPress is a fairly easy install, and we could learn a thing or two about application set-up by examining their code. But I recently switched to using subversion to deploy and maintain our install. In just the little bit I&#8217;ve used subversion [...]]]></description> <content:encoded><![CDATA[<p>I recently wanted to update our install of WordPress to the latest version. WordPress is a fairly easy install, and we could learn a thing or two about application set-up by examining their code. But I recently switched to using subversion to deploy and maintain our install. In just the little bit I&#8217;ve used subversion so far, I believe development and deployment of our internal applications would be simplified by employing it for all our projects. Here&#8217;s a quick outline of the process, with examples based on my WordPress deployment.</p><p><span
id="more-65"></span></p><p><strong>Workflow</strong></p><p>Since we&#8217;re not using an IDE that has integrated subversion capability, and because I wanted to keep the process as simple as possible, I decided to try a combined approach to development. A working copy of project files are checked out from subversion to the development server. Dreamweaver uses the working copy for its remote. Code development will continue as usual in Dreamweaver. When a development milestone is reached the changes are committed to subversion. When the project is ready for deployment, we use tagging to mark a stable copy in the repository and check it out to the production server.</p><p>The main problem I&#8217;ve found with this setup right now is that there is no way to hide the subversion structure from Dreamweaver. Subversion creates a directory to house control files for each directory in the working copy. The subversion control directories can be cloaked, allowing Dreamweaver to function as if these directories don&#8217;t exist, but this is not as feasible for a project with lots of directories.</p><p>I found an extension that can automatically cloak any subversion directories, but it only works for the local copy. So if you&#8217;re willing to go through the process of downloading the entire site you can use the extension to cloak all subversion directories automatically. Read about the extension on <a
href="http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&amp;extid=1018603">Adobe Exchange</a>; I&#8217;ve <a
href="http://techlog.p2061.org/wp-content/uploads/2008/05/cloakscm3.mxp">saved a copy</a> of the extension on the techlog.</p><p>I have set up subversion to ignore the typical Dreamweaver development files (lock files, notes, backups). This allows the benefits of using the Dreamwever environment to its fullest without mucking up the subversion repository with unnecessary data.</p><p>We should also implement configuration options in a single file that is not part of the project files. We would still want to provide a sample configuration file, but the actual configuration file should be created during initial deployment by copying the sample and modifying the parameters. Using a sample file instead of actual configuration in the repository will allow us to upgrade the production server without having to worry about overwriting local settings. Overwriting the configuration is actually not much of a concern so long as the configuration file is not updated in the repository. But implementing this kind of setup does give us a little more security in that regard.</p><p><strong>Subversion setup</strong></p><p>First step in the process is to create a subversion repository. We&#8217;ll create this on the production server because we can see the production server from the development server, but not vice versa. To set up the subversion repository in /inet/svn, run the following command on the production server:</p><blockquote><p><code>svnadmin create /inet/svn</code></p></blockquote><p>Next we&#8217;ll populate the repository with a project. Since we&#8217;re just getting started with subversion we&#8217;ll utilize a well-known repository layout: project, project/branches, project/tags, project/trunk. Create the directory structure on the development server and place the current development files in project/trunk. There are a number of ways to access a subversion server, but for now we&#8217;ll use file-based access over ssh. If I create the project directory in /tmp, I would run the following command to import the project:</p><blockquote><p><code>svn import /tmp/benchmarks svn+ssh://production.server/inet/svn</code></p></blockquote><p><strong>Working with project files</strong></p><p>Now that we have the data in the repository we need to set up a working copy for Dreamweaver. First change to the directory where you want to store the working copy. Then run the following command to check out a working copy:</p><blockquote><p><code>svn checkout svn+ssh://production.server/inet/svn/benchmarks/trunk .</code></p></blockquote><p>Set up this directory as your remote in Dreamweaver and edit as usual.</p><p>At some point in the future you&#8217;ll want to record the changes in the subversion repository. This can be at any time in the development process, but at the very least it&#8217;ll need to be done when a project has reached a stable state and is ready for deployment. Run the following command from the working copy directory:</p><blockquote><p><code>svn commit</code></p></blockquote><p>Once the project has reached a stable state we need to have a way of maintaining that stable copy in the face of future modifications. This is where the branches/tags/trunk structure really comes in handy. The in-development files are always in /trunk. To create a stable release we merely need to create a copy in the /tags directory (where ver.no is the version number, such as 1.0):</p><blockquote><p><code>svn copy svn+ssh://production.server/inet/svn/benchmarks/trunk svn+ssh://production.server/inet/svn/benchmarks/tags/ver.no</code></p></blockquote><p><strong>Deploy the project</strong></p><p>Whether we&#8217;re talking about a home-brewed application or one from an external organization, the steps for deployment are the same. Check out a working copy or export a clean copy to the appropriate directory on the production server. I prefer to check out a working copy because it enables greater flexibility in deployment. If we need to modify a file in the production environment, a working copy enables non-destructive upgrades in the future. Only the files that have been modified in the repository will be updated during a version upgrade. Any conflicting updates will be noted by the subversion client so that they can be addressed. (Of course, this is only really a benefit if significant modifications have not been made to the project between versions.)</p><p>Updating a working copy to a new version is as simple as the following command (executed from the working copy directory):</p><blockquote><p><code>svn switch repository_address .</code></p></blockquote><p><strong>Belt and suspenders</strong></p><p>To avoid loss of our subversion repository we should consider creating a copy on our development server. This would only be used to restore the subversion repository in case of loss or corruption. This can be done using the <code>svnsync</code> command and should be done automatically (via <code>cron</code>). This may not be a necessity as much as a convenience, however, since the repository should be included in the nightly backup.</p><p><strong>General Reading</strong></p><p>What I attempted to provide here was the core commands needed to get started. There&#8217;s a lot more to working with subversion than what I covered and I would recommend .</p><ul><li><a
href="http://svnbook.red-bean.com/">Version Control with Subversion</a> (all you need to know)</li><li><a
href="http://web.archive.org/web/20071217101842/wiki.peopleaggregator.org/Tracking_PeopleAggregator_releases_with_Subversion_vendor_branches">Tracking PeopleAggregator releases with Subversion vendor branches</a></li><li><a
href="http://lookfirst.com/2007/11/subversion-vendor-branches-howto.html">Subversion Vendor Branches Howto</a></li><li><a
href="http://burtonini.com/blog/computers/svn-vendor-2005-05-04-13-55" class="broken_link">Vendor Branches in Subversion</a></li></ul><p>I found the vendor branch concept a bit confusing; so a few extra links for that.</p> ]]></content:encoded> <wfw:commentRss>http://techlog.p2061.org/2008/05/21/using-svn-for-application-deployment/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
