<?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>klenwell press &#187; Miscellany</title>
	<atom:link href="http://klenwell.com/press/category/miscellany/feed/" rel="self" type="application/rss+xml" />
	<link>http://klenwell.com/press</link>
	<description>A Developer's Broadsheet</description>
	<lastBuildDate>Fri, 13 Jan 2012 14:51:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.2</generator>
		<item>
		<title>Forcing /etc/cron.d to Reload on Ubuntu</title>
		<link>http://klenwell.com/press/2010/11/cron-d/</link>
		<comments>http://klenwell.com/press/2010/11/cron-d/#comments</comments>
		<pubDate>Fri, 26 Nov 2010 03:22:53 +0000</pubDate>
		<dc:creator>klenwell</dc:creator>
				<category><![CDATA[Miscellany]]></category>

		<guid isPermaLink="false">http://klenwell.com/press/?p=211</guid>
		<description><![CDATA[There are two options for scheduling a script with cron on linux. Either edit the crontab: $ sudo crontab -e Or link a cron file to /etc/cron.d: $ sudo ln -sv /home/klenwell/crons/my.cron /etc/cron.d/mycron I like option two because it provides a more modular and organized way to enable cron tasks for various projects. The only [...]]]></description>
			<content:encoded><![CDATA[<p>There are two options for scheduling a script with cron on linux. Either edit the crontab:</p>
<pre class="brush: bash">
$ sudo crontab -e
</pre>
<p>Or link a cron file to /etc/cron.d:</p>
<pre class="brush: bash">
$ sudo ln -sv /home/klenwell/crons/my.cron /etc/cron.d/mycron
</pre>
<p>I like option two because it provides a more modular and organized way to enable cron tasks for various projects. The only problem with this method is that, when things go wrong, it&#8217;s been a huge headache trying to figure out what the problem is and how to get the tasks in the linked cron file running again. The cron documentation and Google are frustratingly tight-lipped on the subject of /etc/cron.d. But I think I have figured out a reliable way to configure and trouble /etc/cron.d.</p>
<p>Some rules that will help in using /etc/cron.d:</p>
<ol>
<li>You must specify a user in your cron file.</li>
<li>The script being linked must be owned by root (giving root permission alone doesn&#8217;t seem enough)</li>
<li>To force /etc/cron.d to reload, touch the /etc/cron.d dir: <code>sudo touch /etc/cron.d/</code></li>
</ol>
<p>I was able to confirm these rules by linking a cron file to /etc/cron.d, then changing the owner to myself (klenwell), then checking the /var/log/syslog file.</p>
<p>Cron checks /etc/cron.d minutely, so you have to give it at least 60 seconds to register any changes. I set up my test cron file (/home/klenwell/crons/my.cron) to touch a file in /tmp (/tmp/crontest) every minute. </p>
<p>When the cron file is owned by my user (klenwell), I see this message in the log:</p>
<pre class="brush: bash">
Nov 26 02:55:01 myserver cron[1924]: (*system*mycron) WRONG FILE OWNER (/etc/cron.d/mycron)
</pre>
<p>The linked cron file will not run again until the owner is corrected and the directory touched: </p>
<pre class="brush: bash">
$ sudo chown -v root /home/klenwell/crons/my.cron
$ sudo touch /etc/cron.d/
</pre>
<p>After this, I see this in /var/log/syslog:</p>
<pre class="brush: bash">
Nov 26 02:57:01 myserver CRON[21170]: (klenwell) CMD (   touch /tmp/crontest)
</pre>
<p>Took me a lot of trial and error to figure this out. Hope it saves your an extra headache or two.</p>
]]></content:encoded>
			<wfw:commentRss>http://klenwell.com/press/2010/11/cron-d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Email Fixed</title>
		<link>http://klenwell.com/press/2010/04/wordpress-email-fixed/</link>
		<comments>http://klenwell.com/press/2010/04/wordpress-email-fixed/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 05:33:11 +0000</pubDate>
		<dc:creator>klenwell</dc:creator>
				<category><![CDATA[Miscellany]]></category>

		<guid isPermaLink="false">http://klenwell.com/press/?p=170</guid>
		<description><![CDATA[Fixed email for this blog using this nifty plugin. Now, let&#8217;s see if the recaptcha plugin uses the recommended wordpress mail function.]]></description>
			<content:encoded><![CDATA[<p>Fixed email for this blog using this <a href="http://www.callum-macdonald.com/code/wp-mail-smtp/">nifty plugin</a>.  Now, let&#8217;s see if the recaptcha plugin uses the recommended wordpress mail function.</p>
]]></content:encoded>
			<wfw:commentRss>http://klenwell.com/press/2010/04/wordpress-email-fixed/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ReCaptcha Plugin Added</title>
		<link>http://klenwell.com/press/2010/02/recaptcha-added/</link>
		<comments>http://klenwell.com/press/2010/02/recaptcha-added/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 03:28:54 +0000</pubDate>
		<dc:creator>klenwell</dc:creator>
				<category><![CDATA[Miscellany]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://klenwell.com/press/?p=156</guid>
		<description><![CDATA[First off, let me apologize to all those who have commented in the recent weeks and had their comments held up in moderation limbo. With all the spam I was getting, I got bad about procrasting on moderating comments. Now with this new plugin, hopefully I can relax the moderation and, when moderation, get to [...]]]></description>
			<content:encoded><![CDATA[<p>First off, let me apologize to all those who have commented in the recent weeks and had their comments held up in moderation limbo.  With all the spam I was getting, I got bad about procrasting on moderating comments.  Now with this new plugin, hopefully I can relax the moderation and, when moderation, get to approving comments more quickly.</p>
<p>Next, this plugin should come standard issue with WordPress.  I know the keys are a bit of a hassle.  But WordPress should offer something out or the box, because the amount of spam I get through the comment forms on this site is demoralizing.</p>
<p>Anyway, easy to install and well worth the effort, I hope.  Find reCAPTCHA installation notes here:</p>
<p><a href="http://wordpress.org/extend/plugins/wp-recaptcha/installation/">http://wordpress.org/extend/plugins/wp-recaptcha/installation/</a></p>
<p>Now, let&#8217;s see if this thing works.</p>
]]></content:encoded>
			<wfw:commentRss>http://klenwell.com/press/2010/02/recaptcha-added/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Greqo 4 Released</title>
		<link>http://klenwell.com/press/2009/06/greqo-4-released/</link>
		<comments>http://klenwell.com/press/2009/06/greqo-4-released/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 20:10:52 +0000</pubDate>
		<dc:creator>klenwell</dc:creator>
				<category><![CDATA[Miscellany]]></category>

		<guid isPermaLink="false">http://klenwell.com/press/?p=135</guid>
		<description><![CDATA[Greqo is a PHP project I started a couple years back for Google&#8217;s services. It was an extension of a Blogger API I had written in PHP. I extended it to include Gmail and Google Analytics. I took some time this year to clean it up and recently released Greqo 4. It&#8217;s not really the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/p/greqo/">Greqo</a> is a PHP project I started a couple years back for Google&#8217;s services.  It was an extension of a Blogger API I had written in PHP.  I extended it to include Gmail and Google Analytics.  I took some time this year to clean it up and recently released <a href="http://code.google.com/p/greqo/downloads/list">Greqo 4</a>.  It&#8217;s not really the 4th version.  More like the 2nd.  The 4 signifies full compatability with PHP 4.</p>
<p>For more information on usage, I recommend the <a href="http://greqo.googlecode.com/svn/tags/v4.0/test/">unit and acceptance tests<a href="http://phpmailer.codeworxtech.com/"></a> that come packaged with the source code.</p>
<p>There are probably better PHP libraries for Google&#8217;s Data APIs (e.g. <a href="http://framework.zend.com/manual/en/zend.gdata.html">the Zend Framework</a>.)  </a>PHPMailer, upon which my Gmail library was built, <a href="http://phpmailer.codeworxtech.com/index.php?pg=examplebgmail">now supports Gmail</a> natively.  <a href="http://code.google.com/apis/analytics/">Google Analytics</a> now has an <a href="http://code.google.com/apis/analytics/docs/gdata/gdataDeveloperGuide.html">export API</a>.  And PHP 4, of course, has reached the <a href="http://developers.slashdot.org/article.pl?sid=07/07/14/0646216">end of its life</a>.</p>
<p>But Greqo 4 runs on PHP 5.  And if you need a PHP 4 implementation of these Google APIs, well then here you are:</p>
<p><a href="http://code.google.com/p/greqo/downloads/detail?name=greqo-lib-v4.0.zip&#038;can=2">Download: Greqo 4 Release for Google Mail, Blogger, and Analytics</a></p>
<p>Going forward, the Greqo library will abandon complete PHP 4 compatibility and focus on PHP 5 and, eventually, PHP 6.</p>
]]></content:encoded>
			<wfw:commentRss>http://klenwell.com/press/2009/06/greqo-4-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Command Line Email on Ubuntu (mailx version)</title>
		<link>http://klenwell.com/press/2009/03/ubuntu-email-with-mailx/</link>
		<comments>http://klenwell.com/press/2009/03/ubuntu-email-with-mailx/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 04:53:15 +0000</pubDate>
		<dc:creator>klenwell</dc:creator>
				<category><![CDATA[Miscellany]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://klenwell.com/press/?p=114</guid>
		<description><![CDATA[For a simpler, updated version of this guide, see this page: http://klenwell.com/is/UbuntuCommandLineGmail This guide explains how to configure Ubuntu so that you can send email from the command line using mailx with your Gmail account for delivery. This updates a guide I originally posted on the ubuntu forums for mailx, which is part of the [...]]]></description>
			<content:encoded><![CDATA[<div class="redirect" style="font-weight:bold; padding:4px; border:1px solid blue; color:blue; border-width:1px 0;">For a simpler, updated version of this guide, see this page: <a href="http://klenwell.com/is/UbuntuCommandLineGmail">http://klenwell.com/is/UbuntuCommandLineGmail</a></div>
<p>This guide explains how to configure Ubuntu so that you can send email from the command line using mailx with your Gmail account for delivery.  This updates a guide I originally posted on the <a href="http://ubuntuforums.org/showthread.php?t=780509">ubuntu forums</a> for mailx, which is part of the current Ubuntu repositories (versions 7 and 8).  To use nail, for which this guide was originally drawn up, see <a href="http://www.klenwell.com/press/2009/03/ubuntu-email-with-nail/">this post</a>.</p>
<h4>In 5 Fairly Easy Steps</h4>
<p><strong>1. Install the needed programs</strong></p>
<div class="code">$ sudo apt-get install msmtp<br />
$ sudo apt-get install mailx</div>
<p><strong>2. Install Thawte certificates for Gmail</strong></p>
<p><strong>EDIT: verisign.com apparently no longer issues certs at the address below.  So the &#8216;wget&#8217; step will not work.</strong> adkein, in a comment below (<a href="#comment-146">click here</a>), links to another page when you can apparently get the needed cert.  I cannot vouch for this as my cert still works.  But you might try downloading that and putting it your ~/etc/.certs directory if you&#8217;re having issues finding the cert.</p>
<p>This is necessary for Gmail. (Thanks to <a href="http://laurentbois.com/2007/10/20/activemailer-using-msmtp-and-gmail/">laurentbois.com</a>.)</p>
<div class="code">$ mkdir -p ~/etc/.certs<br />
$ chmod 0700 ~/etc/.certs<br />
$ cd ~/etc/.certs<br />
$ wget https://www.verisign.com/support/thawte-roots.zip &#8211;no-check-certificate<br />
$ unzip thawte-roots.zip<br />
$ cp &#8216;Thawte Server Roots/ThawtePremiumServerCA_b64.txt&#8217; ThawtePremiumServerCA.crt</div>
<p><strong>3. Configure msmtp</strong><br />
This will open up a new msmtp configuration file</p>
<div class="code">$ gedit ~/.msmtprc</div>
<p>Copy the following lines. Replace UPPERCASE text with your personal settings:</p>
<pre class="brush: bash">
# config options: http://msmtp.sourceforge.net/doc/msmtp.html#A-user-configuration-file
defaults
logfile /tmp/msmtp.log

# gmail account
#account gmail
auth on
host smtp.gmail.com
port 587
user YOURNAME@gmail.com
password YOURPASSWORD
from YOURNAME@gmail.com
tls on
tls_trust_file /home/USER/etc/.certs/ThawtePremiumServerCA.crt

# set default account to use (not necessary with single account)
#account default : gmail
</pre>
<p>Change permission on this file or msmtp will complain:</p>
<div class="code">$ chmod 600 ~/.msmtprc</div>
<p><strong>4. Configure mailx</strong></p>
<div class="code">$ gedit ~/.mailrc</div>
<p>Copy the following lines and replace UPPERCASE text with your personal settings:</p>
<pre class="brush: bash">
# set smtp for nail
# ref: http://ubuntuforums.org/showpost.php?p=4531994&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;postcount=6

# gmail account (default)
# $ mailx -s &quot;subject line&quot; -a /path/file recipient@email.com &lt; /path/body.txt
set from=&quot;YOURNAME@gmail.com (YOURNAME)&quot;
set sendmail=&quot;/usr/bin/msmtp&quot;
set message-sendmail-extra-arguments=&quot;-a gmail&quot;
</pre>
<p><strong>5. Run a test</strong><br />
Send a test message to <a href="https://gmail.google.com/gmail">your gmail account</a>:</p>
<div class="code">$ echo -e &#8220;testing email from the command line&#8221; &gt; /tmp/test_email<br />
$ mailx -s &#8220;nail gmail test&#8221; YOURNAME@gmail.com &lt; /tmp/test_email</div>
<p>Check your gmail account and you should have a message from yourself.  You can also check your log:</p>
<div class="code">$ gedit /tmp/msmtp.log</div>
<p>I personally prefer <a href="http://www.klenwell.com/press/2009/03/ubuntu-email-with-nail/">nail</a> because it more easily accommodates multiple accounts.  But if you don&#8217;t have a deliberate need to use multiple accounts and are using a later version of Ubuntu, use this.</p>
]]></content:encoded>
			<wfw:commentRss>http://klenwell.com/press/2009/03/ubuntu-email-with-mailx/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Command Line Email on Ubuntu (nail version)</title>
		<link>http://klenwell.com/press/2009/03/ubuntu-email-with-nail/</link>
		<comments>http://klenwell.com/press/2009/03/ubuntu-email-with-nail/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 05:39:54 +0000</pubDate>
		<dc:creator>klenwell</dc:creator>
				<category><![CDATA[Miscellany]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://klenwell.com/press/?p=110</guid>
		<description><![CDATA[For a simpler, updated version of this guide, see this page: http://klenwell.com/is/UbuntuCommandLineGmailNail This will be the first of two posts showing you how to configure the more recent versions of Ubuntu to send email from the command line as simply as humanly possible using your Gmail account for delivery. These instructions were originally posted on [...]]]></description>
			<content:encoded><![CDATA[<div class="redirect" style="font-weight:bold; padding:4px; border:1px solid blue; color:blue; border-width:1px 0;">For a simpler, updated version of this guide, see this page: <a href="http://klenwell.com/is/UbuntuCommandLineGmailNail">http://klenwell.com/is/UbuntuCommandLineGmailNail</a></div>
<p>This will be the first of two posts showing you how to configure the more recent versions of Ubuntu to send email from the command line as simply as humanly possible using your Gmail account for delivery.  These instructions were originally posted on <a href="http://phosphorusandlime.blogspot.com/2008/05/ubuntu-command-line-email.html">my old blog</a> and on the <a href="http://ubuntuforums.org/showthread.php?t=780509">Ubuntu forums site</a>.</p>
<p>This guide covers using the nail program, which is my client of choice but is no longer in the main repositories.  Find a guide for using mailx, which is part of the current Ubuntu repositories, <a href="http://www.klenwell.com/press/2009/03/ubuntu-email-with-mailx/">here</a>.</p>
<h4>In 6 Fairly Easy Steps</h4>
<p><strong>1. Add the breezy repositories containing nail to your source file</strong><br />
Edit your sources list</p>
<div class="code">$ sudo gedit /etc/apt/sources.list</div>
<p>Add the following lines at bottom.  These will enable you to apt-get nail</p>
<pre class="brush: bash"># breezy repositories (added to install nail)
# see http://old-releases.ubuntu.com/releases/ for more info
deb http://old-releases.ubuntu.com/ubuntu/ breezy universe</pre>
<p>Don&#8217;t forget to update</p>
<div class="code">$ sudo apt-get update</div>
<p><strong>2. Install the needed programs</strong></p>
<div class="code">$ sudo apt-get install msmtp<br />
$ sudo apt-get install nail</div>
<p><strong>3. Install Thawte certificates for Gmail</strong></p>
<p><strong>EDIT: verisign.com apparently no longer issues certs at the address below.  So the &#8216;wget&#8217; step will not work.</strong> According to <a href="http://www.klenwell.com/press/2009/03/ubuntu-email-with-mailx/#comment-146">this comment</a>, you can downloaded the needed cert from <a href="http://www.cs.utexas.edu/~suriya/UT-wireless/ThawtePremiumServerCA_b64.txt">http://www.cs.utexas.edu/~suriya/UT-wireless/ThawtePremiumServerCA_b64.txt</a>.  I cannot vouch for this as my cert still works.  But you might try downloading that and putting it your ~/etc/.certs directory if you&#8217;re having issues finding the cert.</p>
<p>This is necessary for Gmail. (Thanks to <a href="http://laurentbois.com/2007/10/20/activemailer-using-msmtp-and-gmail/">laurentbois.com</a>.)</p>
<div class="code">$ mkdir -p ~/etc/.certs<br />
$ chmod 0700 ~/etc/.certs<br />
$ cd ~/etc/.certs<br />
$ wget https://www.verisign.com/support/thawte-roots.zip &#8211;no-check-certificate<br />
$ unzip thawte-roots.zip<br />
$ cp Thawte Server Roots/ThawtePremiumServerCA_b64.txt ThawtePremiumServerCA.crt</div>
<p><strong>4. Configure msmtp</strong><br />
This will open up a new msmtp configuration file</p>
<div class="code">$ gedit ~/.msmtprc</div>
<p>Copy the following lines. Replace UPPERCASE text with your personal settings:</p>
<pre class="brush: bash">
# config options: http://msmtp.sourceforge.net/doc/msmtp.html#A-user-configuration-file
defaults
logfile /tmp/msmtp.log

# isp account
account isp
auth login
host SMTP.YOURISP.COM
port 25
user YOURNAME@ISP.COM
from YOURNAME@ISP.COM
password YOURPASSWORD

# gmail account
account gmail
auth on
host smtp.gmail.com
port 587
user YOURNAME@gmail.com
password YOURPASSWORD
from YOURNAME@gmail.com
tls on
tls_trust_file /home/USER/etc/.certs/ThawtePremiumServerCA.crt

# set default account to use (from above)
account default : gmail
</pre>
<p>Change permission on this file or msmtp will complain:</p>
<div class="code">$ chmod 600 ~/.msmtprc</div>
<p><strong>5. Configure nail</strong></p>
<div class="code">$ gedit ~/.mailrc</div>
<p>Copy the following lines and replace UPPERCASE text with your personal settings:</p>
<pre class="brush: bash">
# set smtp for nail
# ref: http://ubuntuforums.org/showpost.php?p=4531994&amp;amp;amp;amp;amp;amp;amp;postcount=6

# gmail account (default)
# $ nail -s &quot;subject line&quot; -a /path/file recipient@email.com &lt; /path/body.txt
set from=&quot;YOURNAME@gmail.com (YOURNAME)&quot;
set sendmail=&quot;/usr/bin/msmtp&quot;
set message-sendmail-extra-arguments=&quot;-a gmail&quot;

# isp account (add -A option to command line)
# $ nail -A isp -s &quot;subject line&quot; -a /path/file recipient@email.com &lt; /path/body.txt
account isp {
set from=&quot;YOURNAME@ISP.COM&quot;
set sendmail=&quot;/usr/bin/msmtp&quot;
set message-sendmail-extra-arguments=&quot;-a isp&quot;
}
</pre>
<p><strong>6. Run a test</strong><br />
Send a test message to <a href="https://gmail.google.com/gmail">your gmail account</a>:</p>
<div class="code">$ echo -e &#8220;testing email from the command line&#8221; &gt; /tmp/test_email<br />
$ nail -s &#8220;nail gmail test&#8221; YOURNAME@gmail.com &lt; /tmp/test_email</div>
<p>Check your gmail account and you should have a message from yourself.  You can also check your log:</p>
<div class="code">$ gedit /tmp/msmtp.log</div>
<p>That&#8217;s it.  You should now be ready to incorporate email into your bash scripts, which is great for making backups.  I did successfully test this on an old laptop had installed Ubuntu 8.04 this weekend.</p>
<p>If you have any problems or questions, I&#8217;d recommend posting to the <a href="http://ubuntuforums.org/showthread.php?t=780509">ubuntu forums thread</a> as you&#8217;ll probably get a quicker response there.</p>
]]></content:encoded>
			<wfw:commentRss>http://klenwell.com/press/2009/03/ubuntu-email-with-nail/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PHP4, PHP5, One Server</title>
		<link>http://klenwell.com/press/2009/02/php4-php5-one-server/</link>
		<comments>http://klenwell.com/press/2009/02/php4-php5-one-server/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 05:29:57 +0000</pubDate>
		<dc:creator>klenwell</dc:creator>
				<category><![CDATA[Miscellany]]></category>

		<guid isPermaLink="false">http://klenwell.com/press/?p=100</guid>
		<description><![CDATA[I posted last month on running PHP4 and PHP5 independently on separate local domains on a single Apache server under Ubuntu. This post updates my original post. The goal here is to create two domains: http://php5/ &#8212; running PHP5 via an Apache module http://php4/ &#8212; running PHP4 through CGI The steps below are adapted from [...]]]></description>
			<content:encoded><![CDATA[<p>I posted last month on running PHP4 and PHP5 independently on separate local domains on a single Apache server under Ubuntu.  This post updates my original post.</p>
<p>The goal here is to create two domains:<br />
http://php5/ &#8212; running PHP5 via an Apache module<br />
http://php4/ &#8212; running PHP4 through CGI</p>
<p>The steps below are adapted from the guide found here:<br />
<a href="http://www.howtoforge.com/apache2_with_php5_and_php4">http://www.howtoforge.com/apache2_with_php5_and_php4</a></p>
<h4>Step 1: Install LAMP Server Including Apache2 and PHP5</h4>
<p>If you haven&#8217;t already done this, you can just follow the normal steps using <tt>apt-get</tt> as outlined here:<br />
<a href="https://help.ubuntu.com/community/ApacheMySQLPHP">https://help.ubuntu.com/community/ApacheMySQLPHP</a></p>
<h4>Step 2: Update Sources List to Install php4-cgi</h4>
<p>php4 is no longer included in the Ubuntu repositories as it is no longer supported.  But it can be found in the breezy repositories.  This was the step that took me the longest to figure out as there were no explicit instructions regarding this.</p>
<div class="code"># add breezy to sources<br />
$ sudo gedit /etc/apt/sources.list</div>
<p>Add the following lines to the bottom of the file:</p>
<div class="code"># archive breezy repositories<br />
deb http://old-releases.ubuntu.com/ubuntu/ breezy-updates main restricted<br />
deb http://old-releases.ubuntu.com/ubuntu/ breezy-security main restricted<br />
deb http://old-releases.ubuntu.com/ubuntu/ breezy main restricted<br />
deb http://old-releases.ubuntu.com/ubuntu/ breezy universe<br />
deb http://old-releases.ubuntu.com/ubuntu/ breezy-security universe</div>
<h4>Step 3: Install php4-cgi</h4>
<p>Run the following commands from the command line:</p>
<div class="code">
$ apt-get update</p>
<p># safety first: back up your main apache2 config file<br />
$ sudo cp /etc/apache2/apache2.conf /tmp/apache2.conf</p>
<p># install php4-cgi<br />
$ sudo apt-get install php4-cgi</p>
<p># install php4 packages<br />
$ sudo apt-get install php4-curl php4-domxml php4-gd php4-imap php4-ldap php4-mcal php4-mcrypt php4-mhash php4-mysql php4-odbc php4-snmp php4-xslt curl libwww-perl imagemagick
</p></div>
<h4>Step 4: Create Your Document Roots</h4>
<p>You can put the document roots for your <tt>http://php5/</tt> and <tt>http://php4/</tt> sites anywhere.  For lack of a better general location, I am going to put them under the standard <tt>/var/www/</tt> directory.  The directory tree will look like so:</p>
<div class="code">/var/www/<br />
  &#8211; php5/<br />
    &#8211; apache/  <-- apache config file goes here<br />
    - www/     <-- document root</p>
<p>  - php4/<br />
    - apache/  <-- apache config file goes here<br />
    - www/     <-- document root</div>
<p>Commands:</p>
<div class="code">$ sudo mkdir -p /var/www/php5/www<br />
$ sudo mkdir -p /var/www/php5/apache<br />
$ sudo mkdir -p /var/www/php4/www<br />
$ sudo mkdir -p /var/www/php4/apache</div>
<h4>Step 5: Configure Apache Sites</h4>
<p>First, for the php4 site, add to the <tt>/var/www/php4/apache</tt> directory the file found here:<br />
<a href="http://klenwell.googlecode.com/svn/trunk/templates/apache/php4.conf">http://klenwell.googlecode.com/svn/trunk/templates/apache/php4.conf</a></p>
<p>Then enable this site, by linking the config file to apache&#8217;s <tt>sites-enabled</tt> directory:</p>
<div class="code">$ sudo ln -s /var/www/php4/apache/php4.conf /etc/apache2/sites-enabled/php4</div>
<p>Do the same thing with the php5 file (found <a href="http://klenwell.googlecode.com/svn/trunk/templates/apache/">here</a>) in the <tt>/var/www/php5/apache</tt> directory.</p>
<h4>Step 6: Create Local Domain php4 and php5 in /etc/hosts</h4>
<p>Open up your hosts file in the editor:</p>
<div class="code">$ sudo gedit /etc/hosts</div>
<p>Add this line to your file:</p>
<div class="code">127.0.0.1    php4  php5</div>
<h4>Step 7: Create Test Files</h4>
<p>Open a new file in an editor:</p>
<div class="code">sudo gedit /var/www/php4/www/index.php</div>
<p>Add this line:</p>
<pre class="brush: php">
&lt;?php phpinfo(); ?&gt;
</pre>
<p>Copy the file to <tt>/var/www/php5/www/</tt>:</p>
<div class="code">sudo cp /var/www/php4/www/index.php /var/www/php5/www/</div>
<h4>Step 8: Restart the Apache Server</h4>
<p>Using <tt>apache2ctl</tt>:</p>
<div class="code">sudo apache2ctl -k restart</div>
<p>Finally, test the results by opening the following two urls in your browser:<br />
<a href="http://php5/">http://php5/</a><br />
<a href="http://php4/">http://php4/</a></p>
<p>You should see the PHP Info page for each site displaying the appropriate PHP version.  For the php4 site, it should look something like this:</p>
<div id="attachment_104" class="wp-caption alignnone" style="width: 310px"><a href="http://www.klenwell.com/press/wp-content/uploads/2009/02/php4.png"><img src="http://www.klenwell.com/press/wp-content/uploads/2009/02/php4-300x251.png" alt="phpinfo() for php4 site" title="php4" width="300" height="251" class="size-medium wp-image-104" /></a><p class="wp-caption-text">phpinfo() for php4 site</p></div>
<p>If that all works, you are ready to adapt as suits you.  You can link any php4 projects you are working on to the <tt>php4/www</tt> directory.</p>
<p>The same principles should apply to other systems and circumstances, though you&#8217;ll have to work out the details for yourself.</p>
<p>This guide generalizes details of my own successful installation.  If you try this and have any issues, please leave a comment here.</p>
]]></content:encoded>
			<wfw:commentRss>http://klenwell.com/press/2009/02/php4-php5-one-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rotating Syslogs in Ubuntu</title>
		<link>http://klenwell.com/press/2009/02/rotating-syslogs-in-ubuntu/</link>
		<comments>http://klenwell.com/press/2009/02/rotating-syslogs-in-ubuntu/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 05:24:20 +0000</pubDate>
		<dc:creator>klenwell</dc:creator>
				<category><![CDATA[Miscellany]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://klenwell.com/press/?p=90</guid>
		<description><![CDATA[I have a server running Ubuntu. Log rotation never worked on it for some reason. The log files were getting pretty hairy so I wanted to delete or rotate them. Specifically, to be safe, I wanted to rotate then delete them. You&#8217;d think this is one of those things Google (by way of the ubuntuforums) [...]]]></description>
			<content:encoded><![CDATA[<p>I have a server running Ubuntu. Log rotation never worked on it for some reason. The log files were getting pretty hairy so I wanted to delete or rotate them. Specifically, to be safe, I wanted to rotate then delete them.</p>
<p>You&#8217;d think this is one of those things Google (by way of the <a href="http://ubuntuforums.org/" onclick="window.open(this.href,'_blank');return false;">ubuntuforums</a>) would have covered six ways to Sunday. But useful information is surprisingly sparse. See for yourself:</p>
<p><a href="http://www.google.com/search?hl=en&amp;q=ubuntu+syslog+rotation&amp;btnG=Search" onclick="window.open(this.href,'_blank');return false;">http://www.google.com/search?q=ubuntu+syslog+rotation</a></p>
<p>Anyway, after an hour of frustration looking in vain for someone to spell out the answer for me, I figured it out.</p>
<p>If you want to manually rotate the files, run this command as root (if not root, sudo it):</p>
<div class="code">$ /etc/cron.daily/sysklogd</div>
<p>That rotates the files. Then I just added it to a cron file:</p>
<div class="code">$ crontab -e</div>
<div class="code"># crontab line<br />
0 2 * * * /etc/cron.daily/sysklogd &gt; /dev/null 2&gt;&amp;1</div>
<p>That seems to have licked it.  If you can&#8217;t find the sysklogd file, you&#8217;ve got greater problems than I had, as that gets installed with ubuntu.  I&#8217;d imagine you could find a copy on the web.</p>
]]></content:encoded>
			<wfw:commentRss>http://klenwell.com/press/2009/02/rotating-syslogs-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VB Random: A Different Kind of Random</title>
		<link>http://klenwell.com/press/2009/01/vb-random/</link>
		<comments>http://klenwell.com/press/2009/01/vb-random/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 02:28:14 +0000</pubDate>
		<dc:creator>klenwell</dc:creator>
				<category><![CDATA[Miscellany]]></category>

		<guid isPermaLink="false">http://klenwell.com/press/?p=52</guid>
		<description><![CDATA[A weaker man might be moved to re-examine his faith, if in nothing else, at least in the law of probability. â€” Rosencrantz from Tom Stoppard&#8217;s Rosencrantz and Guildenstern Are Dead A colleague at work emailed this to me today: Check out how well VB.Net&#8217;s Random Number Generator works: I am relieved to say that [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>A  weaker  man  might  be  moved  to re-examine his faith, if in nothing else, at least in the law of probability.</p>
<p>â€” Rosencrantz from Tom Stoppard&#8217;s <em>Rosencrantz and Guildenstern Are Dead </em></p></blockquote>
<p>A colleague at work emailed this to me today:</p>
<div class="quote">Check out how well VB.Net&#8217;s Random Number Generator works:</p>
<p><div id="attachment_54" class="wp-caption alignnone" style="width: 313px"><a href="http://www.klenwell.com/press/wp-content/uploads/2009/01/vb_rand.jpg"><img class="size-full wp-image-54" title="vb_rand" src="http://www.klenwell.com/press/wp-content/uploads/2009/01/vb_rand.jpg" alt="each digit in the phone number field is a random number" width="303" height="677" /></a><p class="wp-caption-text">each digit in the phone number is a new random number, each phone number is generated independently</p></div>
</div>
<p>I am relieved to say that I have no way to independently verify his results.  But he knows what he&#8217;s doing so I trust their accuracy.</p>
]]></content:encoded>
			<wfw:commentRss>http://klenwell.com/press/2009/01/vb-random/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Limitations of svn:ignore</title>
		<link>http://klenwell.com/press/2009/01/the-limitations-of-svnignore/</link>
		<comments>http://klenwell.com/press/2009/01/the-limitations-of-svnignore/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 04:47:31 +0000</pubDate>
		<dc:creator>klenwell</dc:creator>
				<category><![CDATA[Miscellany]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://klenwell.com/press/?p=48</guid>
		<description><![CDATA[I recently discovered the limitations of svn:ignore. Having been spoiled by the ignore file in mercurial, I wasn&#8217;t expecting the hardships subversion had in store for me. And as I quickly learned from google, I&#8217;m not the first to lament its shortcomings. See, for instance, svn:ignore propset. The most frustrating thing is the lack of [...]]]></description>
			<content:encoded><![CDATA[<p>I recently discovered the limitations of svn:ignore.  Having been spoiled by the ignore file in mercurial, I wasn&#8217;t expecting the hardships subversion had in store for me.  And as I quickly learned from google, I&#8217;m not the first to lament its shortcomings.  See, for instance, <a href="http://www.mattromaine.com/2007/06/10/svnignore-propset/">svn:ignore  propset</a>.</p>
<p>The most frustrating thing is the lack of subdirectory support when using <a href="http://athenageek.wordpress.com/2008/04/16/svnignore/">the file option</a>.  It doesn&#8217;t seem like it would be that hard for the parser to support them.  If it did, it would make things tolerable.  What is worse, you can&#8217;t set an ignore prop on a directory until it&#8217;s been added to the repository, effectively rendering useless one of the main conveniences of the feature in the first place.</p>
<p>You can whip up your own clever workarounds, like the one documented here: <a href="http://technicalpickles.com/posts/managing-svn-ignore-with-impunity">Managing svn:ignore with impunity</a>.  Never having used Ruby, I opted for something lazier and less efficient.  But it&#8217;s simple and it works.  Here&#8217;s what I do:</p>
<p>First, I add new directories using the <tt>--non-recursive</tt> option :</p>
<div class="code">me:~mysvnrepo$ svn add &#8211;non-recursive trunk/dir/subdir</div>
<p>This adds only the directory, none of the files, which now gives us the opportunity to set the ignore property.  I usually just ignore (and add) files one by one.  Here&#8217;s the format I use (it took me a bit of trial and error to figure this out):</p>
<div class="code">me:~mysvnrepo$ svn propset svn:ignore file.ext ./path/to/subdir/</div>
<p>For example:</p>
<div class="code">me:~mysvnrepo$ svn propset svn:ignore default.conf ./trunk/dir/subdir/</div>
<p>All together now, from your repository root directory:</p>
<div class="code"e>$ svn add &#8211;non-recursive trunk/dir/subdir<br />
$ svn add trunk/dir/subdir/some_file.ext<br />
$ svn propset svn:ignore default.conf ./trunk/dir/subdir/</div>
<p>For more global exclusions, like backup files or compiled python files, there&#8217;s the <a href="http://www.allegro.cc/forums/print-thread/591258">global-ignores setting</a>.  And there&#8217;s the <a href="http://svnbook.red-bean.com/en/1.1/ch07s02.html#svn-ch-7-sect-2.3.3">subversion manual</a>, but I didn&#8217;t find it all that helpful really.  Probably because it wasn&#8217;t giving me that answer I was looking for.</p>
]]></content:encoded>
			<wfw:commentRss>http://klenwell.com/press/2009/01/the-limitations-of-svnignore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

