Giorgio Valoti writes "Hi all, I was asked to make a comparison between PHP and Perl based solutions for dinamic web sites and/or web apps. I appreciate the power, flexibility and portability of Perl, but what about PHP? Has someone of you tried these solutions and doesn't mind to share the pros and cons? "
I too would like to see some timing characteristics of mod_perl vs PHP. A good test would be programs that do the following:
(Keep in mind that I don't know or use PHP; but if anyone has some good data that could change
I'd be interested in memory consumption as well as timing if anyone is up to the task.
On the other hand, mod_perl requires some tricks to minimize total memory usage. But those tricks are well-known and documented by now.
On another hand, it does a nice job with HTTP handling. Form variables are passed transparently, which makes chaining applications very nice. It's a good tool for basic forms, and simple database work. The database access is not nearly as concise as DBI, however. If you are using MySql, you use $result=mysql_query("select * from foo",$dbhandle);. If you later switch to Sybase, you have to change your function to sybase_query();
On the whole, I would have preferred to use mod_perl start to finish, but some decisions were made before I arrived. I have used perl for authentication, FTP scripts, and a little CGI. The bulk of the site is straight HTML, and the admin screens are PHP. My impression of PHP4 is that it is close to mod_perl in performance, but I have not done an objective benchmark.
This is actually one of the things I don't like about PHP and other, similar tools like ColdFusion. I used Cold Fusion for years and have evaluated PHP as a replacement. Embedding code in the HTML gets messy fast. For smallish applications it's not too bad, but if you have to do complex or large applications, trying to work around the HTML get's frustrating.
I prefer to keep the code and the content as separate as possible.
Agreed. But for quick forms processing, canned queries, and prototyping it works well. Rigorous adherence to coding style standards helps a great deal. (which is true for any other programming venture)
I prefer to keep the code and the content as separate as possible.
As do I. Templates and fully dynamic, database-driven sites are the things I am starting to focus my attention on.
Re:PHP vs Perl
perriko on 2002-06-18T11:20:23
I'll have a look at it and try it... I don't need big fancy stuff... but YAL (yet another language??)