DesignGuy <do********@nowhere.com> wrote:
I've read comparison of Perl vs. PHP regarding features and coding, however
I would like to know how each affects server load.
I am looking at two scripts - one in Perl and the other in PHP - for the
Amazon Product Feed. My understand is that Perl must be compiled on each
execution and that PHP does not, therefore PHP is less of a load on the
server.
I believe that is false. I *used to* believe PHP only had to be
compiled once, but have been informed that unless using commercial
products, PHP is compiled each time, just like perl.
PHP's advantage is that the interpreter doesn't need to be loaded each
time, while vanilla perl needs to load /usr/bin/perl AND compile the
perl script. (perl syntax is a bit more, shall we say.. 'complex'.. so
I'd imagine perl's parse & compile step is a little more expensive)
At least, thats my understanding of PHP "today". I could be wrong, it
would be nice if the compiled version were cached some place.
mod_perl is typically faster than PHP because it can store compiled code
(and data structures) but.. mod_perl is less stable and not as available
as PHP. (mod_perl doesn't work too good when the web server needs to be
shared between multiple users) Mod_perl is also a LOT more difficult to
"get right". (database handles, stale variables and making sure
any HTML templates take advantage of a compiled cache)
Generally, I've found PHP to be faster than perl except with mod_perl.
For really really serious stuff, I'd check into Servlets/JSP or
mod_perl. For wider availability or smaller scale, I've found PHP
better.
Jamie