Fun With C, PHP and Perl

Recently, I have been working on a few non-work projects. They are websites that need to be very extendable so having a seperate backend, middle-ware and UI is very important. After I began looking into how I wanted to design this I began to consider performance, as these sites could potentially have excessive traffic. Now, as I am a Perl and PHP guru I figured I would start there. In thinking about this, I decided that since performance was an issue, and I couldn't decide between Perl or PHP, I turned to C as an alternative.

In the past I have used XS to extend C code to Perl, but I have never used Zend to do the same in PHP. After considering this for some time, I decided this was the only way to go, but before I could start writing the C framework, I needed to make sure I could figure out how to extend it to PHP.

After a few short hours, I had both a static php binary that contained my new test extension, and a dynamic loadable library of the same extension, which is preferrable. I am really suprised at how easy it was to extend this to PHP. In my opinion it is slightly easier then using XS for Perl, but both aren't really that difficult.

Well, now it's time to begin on the C framework for this project. Once that is done, I intend on extending it to both Perl and PHP, that way I'm not locked into one language or the other. All in all though, I think this is a great opportunity to write one API that can be used in 3 languages.

I will be adding a Project for this to http://www.lukedavison.net/index.php?func=projs in case others are interested in extending C code to PHP and/or Perl.