I am creating a small web service which will only be accessed by machines, not users that simply takes a query string and makes a few MySQL queries. I decided to code this in PHP because it is simple and easy to write and does its job well. My boss however, wants we to write it as a CGI in C (using FastCGI) because he says it will be faster and use less memory. I’m not so keen on this idea for a few reasons:
- The MySQL API for C seems to have a lot more calls than the equivalent PHP and need a lot more error handling.
- String manipulation in C is somewhat complicated and messy.
- The code in C is almost 3 times as long as the equivalent code in PHP and looks rather messy, with lots of error handling.
But that’s just my opinion. What other factors do I need to take in to account? Is C the best tool for this job? Or is PHP?
Some points about this:
service in PHP rather than C, because
PHP is a language designed to work
online and C is a general language.