Click to See Complete Forum and Search --> : PHP vs. Perl - Project Advice?


Envex
09-23-2005, 04:50 PM
Hey guys,

Ok, could use a little advice here before I end up in a situation similar to when I decided to make the "smart" move, and switch from mySQL to PostgreSQL. That little move managed to piss off a whole lot of customers, and create me a large headache, so I would rather not repeat that. :)

I'm an excellent Perl developer, and am just working on a new project that will become our new back-bone, as the old one was developed a couple years ago. I'm just starting to use PHP, and decided to use PHP because:

1.) The new project is going to allow other developers to easily develop their own modules and applications, and there's a whole lot more PHP developers out there than Perl.

2.) Regardless, we have to provide service for our software, and it seems that qualified Perl developers are becoming scarce these days. PHP developers on the other hand seem to be a dime a dozen.

3.) This is what all customers want, and I've constantly heard that PHP is much better than Perl.

Now that I'm starting to get into the middle of the development, I'm questioning myself as to whether PHP was the right choice, or if I should just stick with Perl. I can develop in Perl 10 times quicker than PHP, but I'm sure that's just a matter of getting used to PHP.

I'm moreless worried about the resources and flexibility. What I'm developing is quite large, and at the end, I'll have a good 100,000+ lines of code, plus whatever others decide to develop. Of course, not all code will to be loaded for each process, as the software only loads what's required each time, but you get my point. Please know that there there isn't any HTML code anywhere within the PHP code. Instead, all the HTML is stored in outside templates, the mySQL database, etc. There's only maybe 3 or 4 different functions that actually return output to the web browser.

I've always heard that PHP is much quicker than Perl, but now that I'm getting into it and have a fair bit developed, it seems to be slower. The Perl programs I have which are complete and much larger, seem to be run noticeably faster then the PHP program which isn't even near completion yet.

I'm just wondering, with a program of this size, am I walking into a trap by using PHP? Once it's done and released, is there all of a sudden going to be a huge headache because the software is running slow, and taking up too many resources? Am I better off to just stick with Perl? Mainly, I'm just wondering about the server usage between the two for large programs.

I could be wrong, but it seems as though PHP is meant for smaller and more straight forward system. And PHP seems to be really good for easy user-interaction, but that part simply doesn't matter in my case. Regardless if it's PHP or Perl, the software is still going to function the exact same way. Again, could be wrong, but Perl seems like a more stable and flexible language, that is better suited for larger systems.

I know this is a pretty vague post, so please let me know if you have any questions.

Any advice would be greatly appreciated.

Matt

Weedpacket
09-24-2005, 04:15 AM
Sounds like you've already pretty much made up your mind.

Sxooter
09-24-2005, 03:37 PM
1: The database shouldn't be an issue. If you found PostgreSQL tough to develop for, for the love of god, stay away from Oracle or DB2.

2: The customer is most certainly not always right. But you do have to make them happy. I've tested some fairly complex stuff in mod_perl and with php. I've found that for the most part they're both about the same speed.

3: I'm not sure I'd pick a 100,000 line project as one to learn a language. Seems a nice small intranet project with 5 to 10 thousand lines of code would be more forgiving.

4: If your PHP is slow, there could be many reasons. Troubleshooting these problems could take a bit of time. Maybe you're pulling large result sets from mysql all at once, maybe you're doing things in a "perlish" way that doesn't work well in PHP. Hard to say. Bring us some specific examples of somehting that's running slow and somebody should be able to help.

5: I've found that for database driven apps, MySQL runs well for small data sets / simple things, and gets progressively slower with larger sets and more complex queries. When a lot of people start writing to the database, this tends to make things much much worse.

Have you profiled your code a bit to see where things are slow? How much of this project is already done. I have a feeling that whether you want to or not, you're going to have to finish this one in PHP, so you might as well buckle down and figure out what's not running so well, and let us help.

But I'm very curious to know why you felt switching to PostgreSQL was a mistake. Where I work, we curse that fact that every other application we put on our internal web servers is written for just MySQL and we have to put another MySQL database into action. We've also found that most projects that run on Postgresql (or both pgsql and mysql) are better coded and better behaved than most of the mysql only apps, as they are generally developed by people who "get" databases better than the folks who just code for mysql.

csn
09-24-2005, 03:43 PM
FYI - it looks like finally there's an opcode cache available for PHP5. APC resumed updates a few months ago:
http://pecl.php.net/package/APC

None of the others I checked (phpa/ioncube, mmcache, turck, ...) worked with PHP5.

Weedpacket
09-25-2005, 01:27 AM
it looks like finally there's an opcode cache available for PHP5What do you mean "finally"? Zend's been putting out a product for as long as there has been a PHP5 to put a product out for.
3: I'm not sure I'd pick a 100,000 line project as one to learn a language.Especially if you've got customers waiting on it.