How to Join Member's Area Private Library Search Today's Topics p Login
Main Forums Discussion Tech Talk Mature Content Archives
   Nav Win
 Tech Talk
 Geek Stuff
 Why PHP?
 1 2 3
Follow us on Facebook

 Moderated by: Christopher   (Admins )

 
User Options
Format for Better Printing EMail to a Friend Not Available
Admin Print Send ECard
Passions in Poetry

Why PHP?

 Post A Reply Post New Topic   Go to the Next Oldest/Previous Topic Return to Topic Page Go to the Next Newest Topic 
Christopher
Moderator
Member Rara Avis
since 08-02-99
Posts 9130
Purgatorial Incarceration


0 posted 01-19-2005 04:43 PM       View Profile for Christopher   Email Christopher   Edit/Delete Message      Find Poems  View IP for Christopher

Been browsing through some PHP/MySQL books at random as I visit Borders and am wondering why PHP over PERL? (I recall you mentioning somewhere, Ron, that you were either in the process of or considering a change to PHP).

Pros?
Cons?

Is it a separate language? Based on existing languages?

Ron
Administrator
Member Rara Avis
since 05-19-99
Posts 9708
Michigan, US


1 posted 01-19-2005 10:32 PM       View Profile for Ron   Email Ron   Edit/Delete Message      Find Poems   Click to visit Ron's Home Page   View IP for Ron

When you want to output HTML in a Perl script, you embed the content within the script and then print it as needed. PHP stands for Pre-HTML-Processor and was written by a Perl programmer (in Perl, initially) because he wanted a script language that could be embedded directly in standard web pages. He essentially flipped the flop.

The similarities between Perl and PHP are numerous, both in terms of capability and syntax, which is hardly surprising considering its roots. Not siblings, I would think, but certainly first cousins. I personally think PHP is a little clunky and long-winded, but it's not bad, and hey, most people think Perl is much too terse.

I don't think there are any cons to switching to PHP any more (availability of software compared to Perl was a con at one time, but certainly no longer), and really, none of the pros are issues that couldn't be resolved in favor of Perl. For example, database manipulation is built right into the PHP language and pretty easy to use. It's not built into Perl, but the addition of some good libraries can rectify that. It does, however, obviously require more effort and thought to find those good libraries.

The biggest issue today, I think, is implementation.

By default, Perl runs as a stand-alone processor. Every time a visitor calls a script, Apache shells out to the operating system and runs a new process, with all the attendant memory and overhead that involves. PHP, on the other hand, can be (and usually is) compiled as part of the Apache kernel. There are some alternatives, like mod_perl and FastCGI, that allow one to embed Perl into Apache in a similar manner, but they're not as well supported as PHP and, most importantly, most Perl scripts have to be modified to work under them.

There are some tradeoffs, as always, but essentially today's implementation eliminates a ton of overhead and makes PHP almost ten times faster than native Perl.
Christopher
Moderator
Member Rara Avis
since 08-02-99
Posts 9130
Purgatorial Incarceration


2 posted 01-20-2005 12:15 PM       View Profile for Christopher   Email Christopher   Edit/Delete Message      Find Poems  View IP for Christopher

Similiar to JavaScript then, though it sounds like the background server support is the main driver as opposed to client-side support?

Ineresting. I take it it's still a scripting language that doesn't need to be compiled prior to initiation?

Thanks, Ron.
Ron
Administrator
Member Rara Avis
since 05-19-99
Posts 9708
Michigan, US


3 posted 01-20-2005 03:20 PM       View Profile for Ron   Email Ron   Edit/Delete Message      Find Poems   Click to visit Ron's Home Page   View IP for Ron

quote:
Ineresting. I take it it's still a scripting language that doesn't need to be compiled prior to initiation?

Correct, which remains a weakness.

An interpreted language goes through several steps prior to execution, and Zend Optimizer can help eliminate some of that for PHP. Essentially, the product tokenizes the script, caches the encoded results, and then runs that instead of the source code version. The claim about 40 percent increase in speed.
 
 Post A Reply Post New Topic   Go to the Next Oldest/Previous Topic Return to Topic Page Go to the Next Newest Topic 
All times are ET (US) Top
  User Options
>> Tech Talk >> Geek Stuff >> Why PHP? Format for Better Printing EMail to a Friend Not Available
Print Send ECard

 

pipTalk Home Page | Main Poetry Forums

How to Join | Member's Area / Help | Private Library | Search | Contact Us | Today's Topics | Login
Discussion | Tech Talk | Archives | Sanctuary



© Passions in Poetry and netpoets.com 1998-2013
All Poetry and Prose is copyrighted by the individual authors