linux Archive

Alternative PHP Cache (APC) on Debian

February 2nd, 2006

[Update, March 9th: Be sure to read the comments!]

The Alternative PHP Cache is a great way to improve the performance of webservers. I just finished installing it on mokey the server that runs this site and a number of others, primarily because of our increased use of a content management system called eZpublish which is very powerful, but also very memory hungry. There is no Debian package at the moment, so here is how I installed APC:

  1. Download APC:

    cd /usr/local/src

  2. Extract the archive:

    tar -xvvzf APC-3.0.8.tgz

  3. Install php and apache development files:

    sudo apt-get install apache-dev php4-dev

    (if you have apache2 it’s apache2-dev)

  4. Run these commands:

    export CPPFLAGS="-I/usr/include/apache-1.3 -DAPC_PHP4_STAT"
    ./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/bin/php-config

    For apache2 the last line becomes:

    ./configure --enable-apc --enable-apc-mmap --with-apxs=/usr/bin/apxs2 --with-php-config=/usr/bin/php-config

  5. Build it!

    sudo make install

  6. Finally, add this line to the bottom of your /etc/php4/apache/php.ini (or /etc/php/apache2/php.ini)

Good luck, and leave a comment or contact me if you have any problems. If you don’t feel comforable installing apc yourself contact me and I may be able to help.

bash script to upload files from flash drive

September 4th, 2005

Here’s a useful little bash script I just wrote to upload photos from my flash card reader onto my laptop. The script is specific to the flash card file system used by my Canon EOS 300D, but should easily be adaptable for other uses. It is Free Open Source Software and is released under the GNU GPL license.

#! /bin/bash
mount -t msdos /dev/sda1 $MOUNTPOINT
DIR_LIST=`ls $FLASH_PHOTOROOT | grep .canon`
for dir in ${DIR_LIST}
if [ ! -d $LOCAL_PHOTOROOT${dir} ]; then
rmdir -v $FLASH_PHOTOROOT${dir}
chown -R matthew:matthew $LOCAL_PHOTOROOT${dir}

This Penguin Can’t Swim

December 16th, 2004

linux penguin in shower

Sitting happily reading about how to build pptp support into the debian kernel, to get remote access to the Rising Tide office in Oxford working, and I nearly jump out of my skin…


As I turned around I realised the unthinkable had happened – at least for anyone with a laptop – Elissa had spilt a large glass of water all over ‘Aerosol’ [1]


The fact that I’m writing this a day and a half later and the laptop is working is, by my reckoning, incredible. I thought I’d just post what happened, and what I did, in case anyone reading this is unfortunate enough to end up in the same situation.

  • Pull the power cable out the back, quick.
  • Take out the battery.
  • Turn it upside down, shake, and watch the rain coming out of the keyboard. (Such a horrible feeling.)
  • When the rain has subsided, get out the hairdrier.
  • Blow dry from every angle you can think of.
  • If you feel competent enough to take apart the case and blow dry inside, it will help. (I did.)
  • Put the laptop somewhere warm and dry if you can, but not too hot! Leaving the case apart if you’ve already removed it can’t hurt.
  • Wait at least 24 hours.
  • Pray, meditate, or whatever spiritual act you feel may help.
  • Put the case back together.
  • Feel very nervous, and turn the power on.

I was lucky – everything seems to be working, probably in part because of how fast I moved after the spill – I had the laptop unplugged and draining upside down pretty quick! A power-surge to the hard drive could have been a real nightmare. (I have a load of photos on there that aren’t yet backed up.)

[1] Aerosol has been the name of my laptop – a vaio fx250k – since I studied abroad at University of Toronto for a year and did a research project in an atmospheric chemistry research lab. All the computers were named after atmospheric features – stratus, cumulus, that kind of thing.

Update: Lawrence’s poor ibook has just just suffered a similar fate. Lemonade — ouch! But will it recover? Apple vs. Sony, OSX vs Debian, we shall see.

  • Search
  • You are currently browsing the linux archive.

  • Meta

  • Old Browser

    It seems you are using an old web browser (e.g. Internet Explorer 5 or below). This is a security risk to you, since Microsoft no longer releases updates for old versions of Internet Explorer. Also, note that this site is designed to modern internet standards, and the layout may appear strange or plain in older browsers. All the content is still accessible to you, but I strongly recommend you upgrade to a modern, safe, standards-complient browser, such as Firefox. For more information on getting the best experience surfing the web, see