Category Archives: php

Using Flash video metadata to display annotations

Now that you can create a streaming Flash video player with PHP or Ruby and you know add metadata for cuepoints to Flash videos you are ready for something else. The following code will show you how to create a video player with PHP that will watch for metadata events and display annotations contained inside the metadata either over the video itself or in a div on the same page as the movie.
Continue reading

How to compile ImageMagick for PHP by hand

Some time ago I was looking at how to re-size uploaded images in a way that looks good using PHP. I was impressed that when I uploaded a 4M picture to flickr it managed to re-size and compress it into a smaller version that looked correct. I knew they weren't just resizing it so I went on a quest to find out what it took to do the same thing with PHP. The following is step one in that process.

Continue reading

How to map URLs with PHP and lighttpd

On a number of occasions I've wanted to map a section of a site hosted with lighttpd onto a single PHP file that could then be used as a controller. Here is how I go about doing it.

The first part is to re-write the given part of the site to the PHP file you want to be the controller. Add the following to your configuration file:

url.rewrite = (
        "^/(.*)" => "/controller.php"

You can then start with a simple example to see where you will get your URL information from:


The $_SERVER["REQUEST_URI"] value will be the requested URI. You can now break it up into multiple parts with explode:

$urlParts = explode("/", $_SERVER['REQUEST_URI']);
echo $urlParts[1];

At this point you have an array of the URI parts and can map those however you want using PHP.

Tags: ,

How to build the PHP rrdtool extension by hand

I think by now most sysadmin types know about rrdtool and the nice graphs it makes. I recently wanted to create some graphs by hand using PHP so I turned to the php-rrdtool extension. I found that it takes a little work to get it to compile but that could be because I'm not constantly recompiling PHP and just don't know better. You can get this module as an rpm for fedora (php-rrdtool) but I like to compile php by hand so I couldn't use it. I'm going to assume that you know how to compile PHP normally with whatever other items you want to include and that you have the rrdtool development libraries installed or have compiled and installed rrdtool from source.

Continue reading