<?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>Dave Lachapelle &#187; Unix</title>
	<atom:link href="http://www.davelachapelle.ca/category/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davelachapelle.ca</link>
	<description>Web Technology Specialist</description>
	<lastBuildDate>Wed, 24 Mar 2010 20:49:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>PHP Mail() Abuse</title>
		<link>http://www.davelachapelle.ca/2009/08/05/php-mail-abuse/</link>
		<comments>http://www.davelachapelle.ca/2009/08/05/php-mail-abuse/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 15:09:57 +0000</pubDate>
		<dc:creator>Jett</dc:creator>
				<category><![CDATA[Servers]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.davelachapelle.ca/?p=156</guid>
		<description><![CDATA[Recently came up against a bit of a tough nut to crack, so to speak, and thought I&#8217;d write up a quick blog about how I fixed it, in case anyone else has this problem. At MRX, we have several different hosting environments we use, one of which is a shared environment for our smaller [...]]]></description>
			<content:encoded><![CDATA[<p>Recently came up against a bit of a tough nut to crack, so to speak, and thought I&#8217;d write up a quick blog about how I fixed it, in case anyone else has this problem.  At MRX, we have several different hosting environments we use, one of which is a shared environment for our smaller clients.  The problem being that one of those clients had a vulnerability on their site that was allowing spammers to send unauthorized e-mail through our servers, thereby getting us onto a whole bunch of blacklists.</p>
<p>After a bit of searching around, it seems as though its actually possible to completely disable the mail() function from PHP, however, that was only a temporary solution.  This is simply a matter of adding</p>
<p><code>disable_functions "mail"</code></p>
<p>to the php.ini file and reloading the apache configs.</p>
<p>While I searched for an actual solution to the problem, I came up with the idea of attempting to use a php_admin_value flag value to disable e-mail for a specific virtual host inside the htaccess files until I was able to determine which was the offending site.  Again &#8211; brick wall &#8211; PHP doesn&#8217;t support setting disable_functions in the php_admin_value flag.</p>
<p>So, after a bit of searching, I decided to just add the following to each site&#8217;s .htaccess files:</p>
<p><code>php_admin_value sendmail_path "/dev/null"</code></p>
<p>Essentially sending all e-mail to /dev/null for that particular site.  Perhaps not the most elegant solution, but it was effective, as we are no longer sending e-mail through a broken form and I was able to alert the affected client that they had a problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davelachapelle.ca/2009/08/05/php-mail-abuse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sun buys MySQL, Oracle buys Sun&#8230;</title>
		<link>http://www.davelachapelle.ca/2009/04/22/sun-buys-mysql-oracle-buys-sun/</link>
		<comments>http://www.davelachapelle.ca/2009/04/22/sun-buys-mysql-oracle-buys-sun/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 14:30:29 +0000</pubDate>
		<dc:creator>Jett</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.davelachapelle.ca/?p=130</guid>
		<description><![CDATA[So, big news of the week, Oracle just bought Sun Microsystems for some ridiculous amount of money ($7.4 billion in cash).  Aside from the obvious moanings of how I wish I had $7.4 billion in cash just sitting around so I can buy up companies like playing monopoly, this deal has me (and likely a [...]]]></description>
			<content:encoded><![CDATA[<p>So, big news of the week, <a href="http://www.oracle.com/us/corporate/press/018363" target="_blank">Oracle just bought Sun Microsystems</a> for some ridiculous amount of money ($7.4 billion in cash).  Aside from the obvious moanings of how I wish I had $7.4 billion in cash just sitting around so I can buy up companies like playing monopoly, this deal has me (and likely a number of other people) wondering about the future of <a href="http://www.mysql.com" target="_blank">MySQL</a> now that its going to be owned by Oracle.</p>
<p>I&#8217;ve been reading up on the topic a lot, and it seems as though no one&#8217;s really talking about whats going to happen with <a href="http://blogs.mysql.com/kaj/2008/01/16/sun-acquires-mysql/" target="_blank">Sun&#8217;s newest acquisition</a>.  I can&#8217;t say I&#8217;m not just a little concerned, since all of our work here at <a href="http://www.mrx.ca" target="_blank">MRX</a> is powered by MySQL databases.  Thats not to say I&#8217;m afriad of Oracle, just its both expensive (as in not free) and complex.  I&#8217;d argue, so complex that not many people out there who know Oracle are looking for work.</p>
<p>One interesting point I did find when reading up on the topic that I didn&#8217;t really know, is that Oracle does own a number of other database systems including TimesTen, Berkeley DB open source, as well as InnoDB.  However, none of these directly competes with Oracle, whereas MySQL does.  So, the question is, do they monitize MySQL to a lesser degree than Oracle (while maintaining some form of stripped down free version), do they drop MySQL alltogether and provide some form of migration path to Oracle 11g, or do they simply let both co-exist and continue monitizing Oracle.</p>
<p>If I had to guess, I&#8217;d say they will likely monitize MySQL to a lesser degree than Oracle, probably in the form of support contracts mostly, and still continue to provide a free open source version of MySQL.  Obviously they would charge for any new features they decide to add to MySQL along the way.  Probably very similar to Redhat Enterprise&#8217;s business model &#8211; seems to be successful for them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davelachapelle.ca/2009/04/22/sun-buys-mysql-oracle-buys-sun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Jaunty Jackalope</title>
		<link>http://www.davelachapelle.ca/2009/04/21/ubuntu-jaunty-jackalope/</link>
		<comments>http://www.davelachapelle.ca/2009/04/21/ubuntu-jaunty-jackalope/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 13:26:52 +0000</pubDate>
		<dc:creator>Jett</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.davelachapelle.ca/?p=125</guid>
		<description><![CDATA[So, I just upgraded to Ubuntu Jaunty on two of my VMs here at the office.  I know its not set to come out in a final release for a few days, however, we&#8217;re in the process of migrating to a fully virtualized system, and unfortunately Intrepid has some issues with iSCSI connections.  Namely if [...]]]></description>
			<content:encoded><![CDATA[<p>So, I just upgraded to Ubuntu Jaunty on two of my VMs here at the office.  I know its not set to come out in a final release for a few days, however, we&#8217;re in the process of migrating to a fully virtualized system, and unfortunately Intrepid has some issues with iSCSI connections.  Namely if you try and shut down the machine, it&#8217;ll hang because it tries to disconnect the drive before its unmounted and then just throws errors.</p>
<p>Anyway, as per usual, the upgrades went more or less flawlessly &#8211; minus a few symbolic links that needed to be re-created.  Since I don&#8217;t have GUIs on these machines (waste of resources on servers if you ask me), a quick:</p>
<p><code>sudo apt-get update<br />
sudo apt-get install update-manager-core<br />
sudo do-release-upgrade -d</code></p>
<p>And about half an hour later and I was all upgraded.  No more iSCSI disconnection problems, and one new feature I&#8217;ve found that actually changed my whole workflow when it comes to servers.  That being the inclusion of <a href="https://launchpad.net/screen-profiles" target="_blank">screen-profiles</a>, a sort of profile manager for screen allowing you to create default screens that open when you log in, as well as status bars, clocks and notifiers.  If you haven&#8217;t heard of it, I&#8217;d highly recommend you check it out.</p>
<p><a href="http://www.ubuntu.com/testing/jaunty/alpha3">Ubuntu Jaunty Jackalope &#8211; Alpha 3 | Ubuntu</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davelachapelle.ca/2009/04/21/ubuntu-jaunty-jackalope/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting Raid-1 to Raid-5</title>
		<link>http://www.davelachapelle.ca/2008/07/25/converting-raid-1-to-raid-5/</link>
		<comments>http://www.davelachapelle.ca/2008/07/25/converting-raid-1-to-raid-5/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 14:01:10 +0000</pubDate>
		<dc:creator>Jett</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.davelachapelle.ca/2008/07/25/converting-raid-1-to-raid-5/</guid>
		<description><![CDATA[So, I happened across this article today, written by a Scott Wallace, I&#8217;ve copied the text here in case his site goes down for whatever reason. Note, I haven&#8217;t tried this as of yet, but in the future when I fill up my drives, I&#8217;ll likely be able to just buy another 500 gig drive [...]]]></description>
			<content:encoded><![CDATA[<p>So, I happened across this article today, written by a Scott Wallace, I&#8217;ve copied the text here in case his site goes down for whatever reason.  Note, I haven&#8217;t tried this as of yet, but in the future when I fill up my drives, I&#8217;ll likely be able to just buy another 500 gig drive and convert my raid-1 array to a raid-5 array instead of having to buy another 3 whole drives.</p>
<p><a href="http://scott.wallace.sh/node/1521">Converting RAID1 to RAID5 with no data loss | scott.wallace.sh</a></p>
<p><span id="more-72"></span></p>
<p>When you record and download lots of TV, movies, music, etc. it can chew up the disk space pretty quickly. If you don&#8217;t keep on top of your DVD burning you will end up running out of disk space, like me. That&#8217;s okay, I have two 200GB drives mirrored in a RAID1 array. If I break the mirror and concatenate the drives I could use all 400GB of space available to me&#8230; but if one drive died, I would lose everything that was not backed up.</p>
<p>Buying two more drives isn&#8217;t the answer as I only have one more PATA drive connection available. Perhaps I could back everything up, buy two bigger drives, install a new RAID1 array and copy everything back over. That means giving up two perfectly servicable 200GB drives.</p>
<p>If only I could add a third drive and convert the RAID1 array to a RAID5 array. Then I would get the full 400GB of space, and still retain the redundancy. Yeah, right.</p>
<p>&#8230; Then I stumbled across this blog entry in which a guy creates some experimental loopback devices, creates a RAID1 array and then converts it to a RAID5 array with no data loss. I was intrigued.</p>
<p>The theory says that the RAID5 algorithm, when applied to 2 disks only, ends up looking like a RAID1 array except for the RAID metadata. If you overwrite the RAID1 metadata with the RAID5 metadata, mdadm should recognise the 2 disk RAID5 array and not mess with the contents. Once the metadata is updated, you can then add a third partition to the array and grow the RAID5 array to utilise it. All that remains is to then resize the filesystem to fill the new space.</p>
<p>The main question is, am I brave enough to try it?</p>
<p>You bet I am!</p>
<p>Of course, everything is caveated with the usual &#8220;back everything up before you attempt this procedure&#8221; and, like a good boy, I borrowed a 400GB external drive from work and rsync&#8217;d all the important stuff across&#8230; and, with heart in mouth, followed the procedure&#8230;</p>
<p>Boot from a Fedora Core 6 rescue CDROM and get to a command prompt. You must ensure you have a recent kernel (&gt; 2.6.17) and that you have a recent version of the mdadm software:</p>
<p><code># uname -a<br />
Linux localhost.localdomain 2.6.18-1.2798.fc6 #1 SMP Mon Oct 16 14:54:20 EDT 2006 i686 unknown</p>
<p># mdadm --version<br />
mdadm - v2.5.4 - 13 Ocotober 2006</code></p>
<p>Stop the array:</p>
<p><code># mdadm --stop /dev/md0</code></p>
<p>Overwrite the RAID1 metadata with the RAID5 metadata:</p>
<p><code># mdadm --create /dev/md0 --level=5 -n 2 /dev/hda1 /dev/hdb1<br />
mdadm: /dev/hda1 appears to contain an ext2fs file system<br />
size=1946592K  mtime=Sat Apr 14 07:18:32 2007<br />
mdadm: /dev/hda1 appears to be part of a raid array:<br />
level=1 devices=2 ctime=Sat Sep 17 16:17:45 2005<br />
mdadm: /dev/hdb1 appears to contain an ext2fs file system<br />
size=1946592K  mtime=Sat Apr 17 07:18:32 2007<br />
mdadm: /dev/hdb1 appears to be part of a raid array:<br />
level=1 devices=2 ctime=Sat Sep 17 16:17:45 2005<br />
Continue creating array? y<br />
mdadm: array /dev/md0 started.</code></p>
<p>At this point the RAID software decided it wanted to rebuild the array. Uh-oh, there goes my data&#8230; I quickly mounted /dev/md0 and had a look&#8230; all my data is still intact! Oh well, let the software do it&#8217;s thing. Who am I to argue?</p>
<p>Add in the third, new partition:</p>
<p><code># mdadm --add /dev/md0 /dev/hdd1</code></p>
<p>So far, so good. Once the rebuild is complete, grow the RAID5 onto the new partition: (NB: use the &#8211;backup-file option in case the grow is interrupted. It will allow a safe recovery.)</p>
<p><code># mdadm --grow /dev/md0 --raid-disks=3 --backup-file=/mnt/tmp/raid1-5.backup.file<br />
mdadm: Need to backup 128K of critical section ..<br />
mdadm: ... critical section passed.</code></p>
<p>I&#8217;m impressed that I&#8217;ve had no problems so far. The reshaping of the RAID5 from a 2 disk to a 3 disk array takes quite a while (about 6.5 hours for around 200GB of raw data) but the filesystem resize shouldn&#8217;t take anywhere near as long:</p>
<p><code><br />
# e2fsck -f /dev/md0</p>
<p># resize2fs -p /dev/md0</code></p>
<p>Apart from the modification of the RAID metadata, the whole operation can be done &#8220;online&#8221;. I chose to do it from single-user/rescue mode as I wanted to make sure there was no data loss. If you&#8217;re not too bothered then you could leave the whole thing up and running.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davelachapelle.ca/2008/07/25/converting-raid-1-to-raid-5/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Enable/Disable Ubuntu Remote Desktop from the Command Line</title>
		<link>http://www.davelachapelle.ca/2008/07/23/enabledisable-ubuntu-remote-desktop-from-the-command-line/</link>
		<comments>http://www.davelachapelle.ca/2008/07/23/enabledisable-ubuntu-remote-desktop-from-the-command-line/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 13:48:18 +0000</pubDate>
		<dc:creator>Jett</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.davelachapelle.ca/2008/07/23/enabledisable-ubuntu-remote-desktop-from-the-command-line/</guid>
		<description><![CDATA[Further to my previous postings about Ubuntu and VNC, which seems to have been the most popular page on my blog for a while, I happened across this post from Sam Lesher this morning on how to enable Ubuntu&#8217;s built-in remote desktop from the command line. The built-in remote desktop uses VNC, and so kind [...]]]></description>
			<content:encoded><![CDATA[<p>Further to my previous postings about Ubuntu and VNC, which seems to have been the most popular page on my blog for a while, I happened across this post from Sam Lesher this morning on how to enable Ubuntu&#8217;s built-in remote desktop from the command line.  The built-in remote desktop uses VNC, and so kind of eliminates the need for any form of VNC Server setup.</p>
<p><a href="http://www.samlesher.com/ubuntu/ubuntu-704-enabledisable-remote-desktop-from-the-command-line/">Sam Lesher » Ubuntu 7.04 &#8211; Enable/Disable Remote Desktop from the Command Line</a></p>
<blockquote><p>To enable remote desktop from the command line, issue this command:</p>
<p><code>$ gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true</code></p>
<p>To disable remote desktop from the command line, issue this command:</p>
<p><code>$ gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled false</code></p></blockquote>
<p>Unfortunately, this only works if you have previously configured remote desktop with a password, which would in theory require physical access to the machine.  That being said though, I want to set it up remotely, and so to add to Sam&#8217;s guide, I&#8217;d like to add that you can X-Forward a gnome session through SSH which will allow you to change this option.  I&#8217;m working on a how-to which I will post shortly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davelachapelle.ca/2008/07/23/enabledisable-ubuntu-remote-desktop-from-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New projects</title>
		<link>http://www.davelachapelle.ca/2007/10/17/new-projects/</link>
		<comments>http://www.davelachapelle.ca/2007/10/17/new-projects/#comments</comments>
		<pubDate>Wed, 17 Oct 2007 15:42:06 +0000</pubDate>
		<dc:creator>Jett</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Site Updates]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.davelachapelle.ca/2007/10/17/new-projects/</guid>
		<description><![CDATA[So, I&#8217;ve been insanely busy the last few weeks, and haven&#8217;t taken any time out of my busy schedule to write anything of interest here. I&#8217;ve been really busy with work and life, but I won&#8217;t bore you with the details of that&#8230; I will however, take a few seconds to introduce a project I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve been insanely busy the last few weeks, and haven&#8217;t taken any time out of my busy schedule to write anything of interest here.  I&#8217;ve been really busy with work and life, but I won&#8217;t bore you with the details of that&#8230;</p>
<p>I will however, take a few seconds to introduce a project I&#8217;ve decided to work on (as if I wasn&#8217;t busy enough already).  As you know, I play WoW fairly regularly (World of Warcraft for those un-educated).  There are many resources for the game, and a LOT of addons amongst various sites.  Keeping your addons up-to-date unfortunately can be quite the chore, and so some wonderful people over at WoWAce (www.wowace.com), have written a small program to search through their site and find updated addons.  Unfortunately, they wrote it in .Net, which obviously doesn&#8217;t help us Mac users out there.  In comes the Java WoWUpdater: http://sourceforge.net/projects/javawowupdater  a small project I&#8217;ve taken on, to port the WoWAce Updater to Java allowing it to be truly cross-platform.</p>
<p>I&#8217;ll keep you all posted on my progress, but for now there isn&#8217;t much to show or tell.  If anyone&#8217;s interested in helping me out on this project, and knows anything about UI design or Swing, I&#8217;d be most appreciative of the help.</p>
<p>Well thats it for now, have fun everyone!</p>
<p>J.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davelachapelle.ca/2007/10/17/new-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL qCache goodness</title>
		<link>http://www.davelachapelle.ca/2007/09/18/mysql-qcache-goodness/</link>
		<comments>http://www.davelachapelle.ca/2007/09/18/mysql-qcache-goodness/#comments</comments>
		<pubDate>Tue, 18 Sep 2007 18:44:21 +0000</pubDate>
		<dc:creator>Jett</dc:creator>
				<category><![CDATA[Servers]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.davelachapelle.ca/2007/09/18/mysql-qcache-goodness/</guid>
		<description><![CDATA[I have to start off by apologizing, I had intended on posting this last week, but got tied up with a lot of work stuff. Our Windows server decided to throw a hissy fit, and I really hate windows. Somehow the permissions got all messed up and IIS wouldn&#8217;t read any of the web files, [...]]]></description>
			<content:encoded><![CDATA[<p>I have to start off by apologizing, I had intended on posting this last week, but got tied up with a lot of work stuff.  Our Windows server decided to throw a hissy fit, and I really hate windows.  Somehow the permissions got all messed up and IIS wouldn&#8217;t read any of the web files, we spent almost three full days trying to get the permissions set back up.  Finally we just gave up and decided to back up the system and re-install it.</p>
<p>Anyway, continuing on the theme of system optimizations, I thought I&#8217;d talk a little bit about a simple optimization you can make to MySQL, that will greatly increase your server performance.  In comes MySQL&#8217;s Query Cache or qCache for short.  Its already built into MySQL, all you need to do is enable it.  &#8220;But caching data is bad&#8221; or, &#8220;My boss says we update our data too much to make it worth caching&#8221;.  Both of these ideals are in fact wrong.  I used to hold to the one that said that caching data is bad, yes, it generally is a bad idea if done improperly, but if done properly it&#8217;ll save you a lot of time.</p>
<p><span id="more-16"></span>So, MySQL&#8217;s qCache works by storing the result sets generated by select statements in memory, saving hard drive access and processor time on subsequent calls to that query.  Since most websites are front-end heavy, where the end user is requesting a significant amount of data, and not modifying that data very often, storing the results of common queries in memory saves a lot of time and processor power.  But what happens if you are changing data, well MySQL is smart enough to recognize when a table has changed (via an insert or update statement).  Upon change to a table, it will simply drop all the data pertaining to that table from the cache and start again.  So, in all, qCache doesn&#8217;t actually save anything on the first page load, in fact it takes slightly more overhead as the results have to be stored to memory, but on subsequent hits to that page, you will save a lot of time.</p>
<p>For example, on one of our more heavily trafficed production servers at Barking Dog, our Query cache has been running for 23 hours since its last restart.  It has stored over 115,334 queries, and served up 18,810,168 requests.  That means, 18 million requests have been served out of memory instead of our of the database.  Or if you break it down, 227 requests per second on average.</p>
<p>So, you&#8217;re now no doubt thinking, hey that could save us a lot of money in expensive server upgrades.  How do I install it?  Well, here&#8217;s a quick tutorial, I&#8217;ll write up a full guide when I have time and put it in the guides section of the site.</p>
<p>First off, you&#8217;ll need to edit your MySQL configuration file (in my case /etc/my.cnf), look for the section labelled [mysqld] and add the following:</p>
<blockquote><p>[mysqld]</p>
<p>query_cache_size = 50M<br />
query_cache_limit = 1M</p></blockquote>
<p>Restart MySQL, and you&#8217;re good to go.</p>
<p>Now, you&#8217;ll probably want to tweak it a bit more for your own server, for instance, the settings above allow us to store a total of 50 Megabytes of query data, in my case, more than enough, and limits the maximum data stored in one query to 1MB.  Meaning, queries that return more than 1MB of data won&#8217;t be cached.</p>
<p>Now, you&#8217;ll no doubt want to see the results to make sure that the query cache is actually working, you can do so using one of two methods.  If you have phpMyAdmin, you can simply log in and go into the &#8220;Runtime Information&#8221;.  You should see a section at the bottom under &#8220;More status variables&#8221;:</p>
<blockquote><p>Qcache free blocks 	 5789<br />
Qcache free memory 	 18810168<br />
Qcache hits 	 4161229<br />
Qcache inserts 	 115334<br />
Qcache lowmem prunes 	 31113<br />
Qcache not cached 	 169179<br />
Qcache queries in cache 	 14302<br />
Qcache total blocks 	 35561</p></blockquote>
<p>Or you can issue the following mysql command:</p>
<blockquote><p>mysql&gt; SHOW STATUS LIKE &#8216;%qcache%&#8217;;</p></blockquote>
<p>Thats it, you&#8217;re done.  Enjoy the nice and fast MySQL response times.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davelachapelle.ca/2007/09/18/mysql-qcache-goodness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>APC Saves the day</title>
		<link>http://www.davelachapelle.ca/2007/09/11/apc-saves-the-day/</link>
		<comments>http://www.davelachapelle.ca/2007/09/11/apc-saves-the-day/#comments</comments>
		<pubDate>Tue, 11 Sep 2007 14:10:27 +0000</pubDate>
		<dc:creator>Jett</dc:creator>
				<category><![CDATA[Servers]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.davelachapelle.ca/2007/09/11/apc-saves-the-day/</guid>
		<description><![CDATA[And no, thats not APC as in American Power Conversion, thats APC as in Alternative PHP Cache. At the office, we host a fair number of high traffic websites, sites that routinely push a few gigs of traffic a day each. Obviously, thats a lot of web traffic, and we do have to keep our [...]]]></description>
			<content:encoded><![CDATA[<p>And no, thats not APC as in American Power Conversion, thats APC as in Alternative PHP Cache.  At the office, we host a fair number of high traffic websites, sites that routinely push a few gigs of traffic a day each.  Obviously, thats a lot of web traffic, and we do have to keep our servers running fairly well.  We also have a few, what we refer to as &#8220;seasonal&#8221; sites, where traffic for the sites spikes during certain parts of the year.</p>
<p><span id="more-15"></span>Well, this week, as expected, our traffic spiked and our servers were getting crushed under the load.  While I was searching for a solution, I happened across the APC Opcode Cache for PHP.  After reading through the documentation, I was fairly confident that it would help us out, as our main bottleneck wasn&#8217;t serving the pages, or processor usage, it was hard drive accesses.  I also realized it was in the PECL library, which I figured would make the install process much easier.  How wrong I was.  Turns out, PECL is semi-broken on our Redhat 4 system and thus I had to download and compile the module from source.</p>
<p>Just to maintain a record, and for reference to anyone else out there trying to do this, I&#8217;ve outlined the steps that I had to take below to get the damn thing working.</p>
<p>First, I started with a simple command to install it, figuring that if it worked I wouldn&#8217;t have to do anything else.  If this command works, then feel free to skip the rest of the steps below:</p>
<blockquote><p>sudo pecl install apc</p></blockquote>
<p>Okay, well that failed, after googling around, I determined that PECL was actually broken on my system, and since I didn&#8217;t really feel like, or have the time to fix it, I decided to just compile from source.</p>
<p>So, I grabbed the source and extracted it:</p>
<blockquote><p>wget http://pecl.php.net/get/APC-3.0.14.tgz<br />
tar -zxvf APC-3.0.14.tgz<br />
cd APC-3.0.14</p></blockquote>
<p>After flipping through the install manual, I determined that it should be a simple matter of configure and make install.  I needed to know where php-config was on the system for this to work:</p>
<blockquote><p>sudo locate php-config<br />
./configure &#8211;enable-apc &#8211;with-php-config=/usr/bin/php-config</p></blockquote>
<p>Well, that sure didn&#8217;t work, as there wasn&#8217;t a configure script in the folder (I really should&#8217;ve checked first).  So, I googled around a bit more, and found out that I needed to run phpize, which would give me a configure script and let me go on my merry way.</p>
<blockquote><p>sudo /usr/bin/phpize</p></blockquote>
<p>Oops, I didn&#8217;t have autoconf or automake installed.</p>
<blockquote><p>sudo up2date &#8211;install autoconf automake<br />
sudo /usr/bin/phpize</p></blockquote>
<p>Hmmm&#8230; I could&#8217;ve sworn I&#8217;ve compiled stuff on this system before.  Looks like I&#8217;m missing libtool as well:</p>
<blockquote><p>sudo up2date &#8211;install libtool libtool-libs</p></blockquote>
<p>Okay, lets try that one more time.</p>
<blockquote><p>sudo /usr/bin/phpize<br />
sudo ./configure &#8211;enable-apc<br />
sudo make install</p></blockquote>
<p>Hurray! It installed and the module is where it needs to be.  Now its time to do some simple configuration (since I know the defaults won&#8217;t work for this system).</p>
<blockquote><p>sudo vim /etc/php.ini</p></blockquote>
<p>Add the following to the extensions section:</p>
<blockquote><p>extension=&#8221;apc.so&#8221;</p></blockquote>
<p>At the end of the file, I added this to configure APC:</p>
<blockquote><p>; APC Configuration<br />
[apc]<br />
apc.enabled = 1<br />
;apc.shm_segments = 5<br />
apc.shm_size = 50<br />
apc.num_files_hint = 1000<br />
apc.user_entries_hint = 4096<br />
apc.ttl = 1800<br />
apc.user_ttl = 3600<br />
apc.gc_ttl = 3600<br />
apc.cache_by_default = On<br />
apc.file_update_protection = 10<br />
apc.max_file_size = 1M<br />
apc.stat = 1<br />
apc.write_lock = 1<br />
apc.report_autofilter = 0<br />
apc.localcache = 0<br />
apc.localcache.size = 512<br />
apc.include_once_override = 1</p></blockquote>
<p>I originally had the apc.shm_segments defined, but that was causing warnings and to save the log files from filling up with warnings, I just commented out the line.   Obviously when you&#8217;re done all this, you&#8217;ll need to restart apache:</p>
<blockquote><p>sudo apachectl configtest<br />
sudo /etc/init.d/httpd restart</p></blockquote>
<p>And you&#8217;re all done.  APC comes with a nice php script (apc.php), which you should put in a secure place on your web server.  When you go to it, you can see various bits of information about the cache as well as its current status.  Our cache has now been running for almost 23 hours, has a hit rate of 99.9% and has served up some 4,052,066 hits.  Thats 4 Million less reads from our hard drives!  So, for anyone out there struggling with PHP performance issues, but wary of using a web cache, like squid.  I would highly recommend you install and use APC, it will save you a lot of time and money in processor usage.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davelachapelle.ca/2007/09/11/apc-saves-the-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>25 Linux/UNIX commands that you must know</title>
		<link>http://www.davelachapelle.ca/2007/08/21/25-linuxunix-commands-that-you-must-know/</link>
		<comments>http://www.davelachapelle.ca/2007/08/21/25-linuxunix-commands-that-you-must-know/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 13:49:44 +0000</pubDate>
		<dc:creator>Jett</dc:creator>
				<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.davelachapelle.ca/2007/08/21/25-linuxunix-commands-that-you-must-know/</guid>
		<description><![CDATA[You must know these commands to make it in Linux/UNIX. The following contains a list of commands as well as descriptions and examples of each command. read more &#124; digg story]]></description>
			<content:encoded><![CDATA[<p>You must know these commands to make it in Linux/UNIX.  The following contains a list of commands as well as descriptions and examples of each command.</p>
<p><a href="http://www.freebsd-world.com/Stories/16.php">read more</a> | <a href="http://digg.com/linux_unix/25_Linux_UNIX_commands_that_you_must_know">digg story</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.davelachapelle.ca/2007/08/21/25-linuxunix-commands-that-you-must-know/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
