FUSE Extension for PHP

Well, it's official... I'm a geek. A few weeks ago I started writing an extension for the PHP runtime that provides bindings to libfuse. Back up a few months— I wrote a PHP script to screen-scrape the Trac web interface and allow me to grab source code to a project I'm working on.

My solution worked but it was pretty ugly. So I wondered if it would be better to implement a FUSE file system to do the same task. Unfortunately PHP didn't have bindings for libfuse at the time. After several failed attempts at using SWIG to automagically generate an extension, I came to the harsh realization that if I wanted FUSE bindings I'd have to do it myself. I mean... how hard could it be?

It actually wasn't too bad. I read a bunch of non-existent documentation on the Zend API and went to work on a prototype. It took me about a week, but I now have a working PHP extension. I've also since implemented TracFS to replace my ugly script.

I'm almost finished with writing the documentation for the PHP website. To build the extension, you have to check out the sources from CVS.

$ svn co http://svn.php.net/repository/pecl/fuse/trunk/ php_fuse
$ cd php_fuse && phpize
$ ./configure
$ make && sudo make install

You'll need to install PHP and FUSE (or MacFUSE) before you can build the extension. Once everything is installed, you can test php_fuse with the scripts in pecl/fuse/examples. For now, the extension does not support writing files, only reading. Sometime in the near future I will implement the rest of the VFS callbacks.