web dev 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:

    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.

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)
All email accounts
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

Rising Tide site redesign

May 16th, 2005

It’s been long overdue. On the train back from San Francisco I finished the redesign of the Rising Tide website. Along side a standards-based redesign of the original site structure, using a fluid 3 column css-layout, I’ve built the site around Drupal, an open-source Content Management System that alows for collaborative publishing rather like Indymedia (actually, Drupal is used by a number of Indymedia sites.) Hopefully that should go some way to redeeming me for routinely failing to get London Rising Tide‘s events up on the Rising Tide UK site in time!

webcalendar upcoming events list

April 4th, 2005

I’ve been working on some basic integration of webcalendar and wordpress for the Guelph Students for Environmental Change site. It took a tiny bit of hacking, and I couldn’t find an answer anywhere else online, so I thought I’d post how I did it…

The idea I had was fairly simple – to have an online calendar where people in GSEC could login and add events, but that was publicly accessible to anyone visiting the site. Webcalendar seemed an obvious choice, but I also wanted an ‘Upcoming Events’ list on the home page. Webcalendar has some support for this, but the default upcoming.php spat out a complete html page, so the only way to integrate that to the site home page would have been with an iframe. Not ideal. The solution is quite simple, involving stripping all the superfluous html generation out of upcoming.php, so it just returns the definition list of events.

Here’s my version of upcoming.php

Instructions for use:

  1. If you’re using WebCalendar v0.9.45 (13 Dec 2004), the same version I customised, you should be able to download that file, rename it to remove the .txt extension, and drop it in as a replacement for upcoming.php. If you’re using a different version, who knows!
  2. On the page where you want the events list, add the following line, with the URI pointing to upcoming.php on your site:

    <?php include("http://example.com/webcalendar/upcoming.php"); ?>

This modification to the original Webcalendar file is released under the GNU GPL.

  • Search
  • You are currently browsing the matthewcarroll.ca web dev 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.