technology 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
    wget http://pecl.php.net/get/APC-3.0.8.tgz

  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:

    phpize
    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!

    make
    sudo make install

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

    extension=apc.so

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.

Ban Terminator!

October 14th, 2005

For thousands and thousands of years, ever since agriculture began, farmers have been saving seeds to replant the following year. It’s a practice that is fundamental to the entire global system of food production, and for small scale and subsitance farmers, and Indigenous Peoples, in many cases their very survival depends on the ability to save viable seed from one year to the next.

So nobody would want to stop farmers saving seed, right? “Of course not,” I would have said, if you had asked me that question a few months ago, “no person, company or government in their right mind would seriously start messing with the very life processes that ensure our survival, would they?”

Yes, they would. And they are. It’s called Terminator Technology, and it’s scary stuff. Not only are corporations and governments trying to stop farmers saving seeds, they’re doing so by genetically modifying the plants so that they produce seeds that are sterile. That’s right, sterile seeds — by some twisted logic motivated by profit that flies in the face of thousand of years of common sense and traditional practices.

The good news is that we can stop it. There is a really important United Nations meeting coming up next March that has the power to Ban Terminator if we put enough pressure on governments now and in the run up to the meeting. Please take the time to visit the Ban Terminator Campaign website — I’ve been working on the technical side of it solidly all this week, and there is a good resource of information growing there already that explains what Terminator Technology is, and most importantly how YOU can help get Terminator banned. This one is winnable, but we need your support. Spread the word.

www.banterminator.org

Time Since Plugin

September 17th, 2005

At the bottom of each post on this site, a wonderful little WordPress plugin adds how long it’s been since the post was made. It’s called Time Since. But there’s a bug in the example ‘how to use’ code… actually a few, so I’m posting updated examples of how to use the plugin here in the hope that people wondering why this plugin won’t work for them as instructed on their site will pick up on it. Good luck!

Since Entry Publication:

<?php if (function_exists('time_since')) {
echo time_since(abs(strtotime($post->post_date_gmt . " GMT")), time()) . " ago";
} else {
the_time('F jS, Y');
} ?>

Since Comment Publication:

(I don’t use this second example, so I haven’t tested it, but the problem appears to be identical.)

<?php if (function_exists('time_since')) {
echo time_since(abs(strtotime($comment->comment_date_gmt . " GMT")), time()) . " ago";
} else {
the_time('F jS, Y');
} ?>

Server Trouble

September 14th, 2005

Update: All websites and services are now back online. Contact me if you are experiencing any problems.

We’ve had some fairly major server problems this week, as many of my colleagues (and many of my friends) who I share an online home with know. We suffered some website vandalism and consequently had to take the server offline while we sorted everything out. If you look through the list of community, campaigning and small, personal websites listed below — many of which are hosted for nothing as solidarity with great community work and activism — you’ll be able to imagine the chorus of dismay that followed when we were forced to take the server offline.

This is just a quick note to let everyone affected know which sites have been restored, and which are still offline, and to apologise for all the inconvenience. Anyone I’ve talked to this week will know it has affected me as much as it has you.

I’m still working hard to bring the remaining sites back online, and once everything is back to normal I will be contacting everyone affected in person. In the mean time I will update the list below as I get the final few websites back online, but do contact me if you have been affected by all of this and want to find out the latest or if there is anything urgent I can help with.

Best wishes to everyone, and my sincere apologies — Matthew

Services now back online:

Mailman (mailing list software)
FTP
All email accounts
Webmail
SpamAssassin (spam email filtering)

Note: You will need to set your email software to use a secure connection. Contact me if you have any trouble with this.

All sites now back online:
The Pledge Against Airport Expansion
Guelph Students for Environmental Change
Elissa Smith
Rising Tide
The Yellow House
Climate Outreach Information Network
Dave Carroll
Plan B
No New Oil
Art Not Oil
National Petroleum Gallery
Hugh & Zoe
Rubbish Monsters

Finally two new sites joined us this weekend, after most things got back to normal:

Scholarship Training Series
Ban Terminator

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
MOUNTPOINT="/mnt/flash/"
FLASH_PHOTOROOT=$MOUNTPOINT"dcim/"
LOCAL_PHOTOROOT="/home/matthew/photos/"
mount -t msdos /dev/sda1 $MOUNTPOINT
DIR_LIST=`ls $FLASH_PHOTOROOT | grep .canon`
for dir in ${DIR_LIST}
do
if [ ! -d $LOCAL_PHOTOROOT${dir} ]; then
mv -v $FLASH_PHOTOROOT${dir} $LOCAL_PHOTOROOT
else
mv -v $FLASH_PHOTOROOT${dir}/* $LOCAL_PHOTOROOT${dir}
rmdir -v $FLASH_PHOTOROOT${dir}
fi
chown -R matthew:matthew $LOCAL_PHOTOROOT${dir}
done
umount $MOUNTPOINT



  • Search
  • You are currently browsing the matthewcarroll.ca technology 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 browsehappy.com.