For a long time I wanted to be able to run both PHP 4 and PHP 5 on the same server. Now I finally managed to come up with a solution that is easy to install and easy to use.

  1. Add the Debian Backports repository to your /etc/apt/sources.list
    deb http://www.backports.org/debian/ sarge-backports main contrib non-free
  2. Issue a package update: aptitude update
  3. Install PHP 5 as CGI module: aptitude install php5-cgi
  4. Configure Apache by adding the following lines to your main config file. In my case this was /etc/apache2/apache2.conf
    ScriptAlias /php5-cgi /usr/lib/cgi-bin/php5
    Action php5-cgi /php5-cgi
  5. Now find the Virtual Host you want to run on PHP 5 and simply put the following line into the <Directory> directive.
    AddHandler php5-cgi .php
    This overrides the default handler for files ending in .php which would be the normal PHP 4 module. Whit this directive it is now parsed and executed by the PHP 5 CGI binary.
  6. Reload your webserver config with
    /etc/init.d/apache2 reload

Another entry in my virtual “braindump” category, so I don’t have to look it up somewhere else all the time.

If you want to periodically delete files in a specific directory the unix program find comes to the rescue. In my specific case I needed to delete all the movie files from a surveillance camera that where older than 30 days.

This is the crontab entry to accomplish that:
0 0 * * * /usr/bin/find /videos/ -type f -name '*.avi' -mtime +30 -exec rm {} \;
(everything in one line)

The code runs the program /usr/bin/find every day at midnight (0 0 * * *). It checks the directory called /videos for everything that is a file (-type f), has a name that ends in .avi (-name '*.avi') and is created 30 days ago or before that (-mtime +30).
The command then executes rm (remove) on all those files (-exec rm {} \;).

Since I sometimes had very poor Internet connections over the last few month I thought about how I could lower the data transfer volume on my Mac. One of the things that already bothered me since ages is that Exchange accounts in Apple Mail always sync the Public Folders. I never want to read those items and they are really useless.

After a bit of searching around I found two solutions that worked for me. One is only applicable if you are a Domain Administrator on the Exchange server, the other one is not so elegant but also works if you just have a mail account.

As Domain Administrator

  1. Log into the Exchange server and open the “Active Directory Users and Computers” management console.
  2. Find your acoount, click on “Properties” and select the “Exchange Features” tab
  3. Select “IMAP4” and click on “Properties”
  4. Disable “Use protocol defaults” and uncheck “Include all public folders when a folder list is requested”

Now give the Exchange some time to get the changes. After a while the Public Folders shouldn’t be displayed any more and when syncing this IMAP account they are left out as well.

On your local account

  1. Quit Mail
  2. Go to ~/Library/Mail/ (that’s the Library folder in your home directory) and find the folder that holds all the folders & messages for the Exchange account.
  3. Delete all the contents of “Public Folders” (always back-up first, before you delete 😉 )
  4. Select “Public Folders” and press CMD+I to get the Info. (or CTRL+click on it and select “Get Info”)
  5. Now under “Ownership & Permissions” set the folder to “No Access”
  6. Start Mail and observe the beauty of an Exchange IMAP account that doesn’t do useless Public Folders syncing!