When should you use PHP?

March 23, 2001, 01:02 PM —  LinuxWorld.com — 


Should you learn PHP? Probably so, if:

  • You're responsible for a Website
  • Others in your organization like using PHP
  • You want something "lighter" and easier to learn than Perl or Python
  • You favor free software
  • You need access to data locked in databases
  • You want to exploit Java
  • You already use PHP in one way, and have been wondering what else it can do for you


Humble beginnings



Rasmus Lerdorf wrote a rudimentary version of the PHP scripting language in late 1994 as an aid to managing his personal homepage. (Originally the name PHP stood for Personal Home Page Tools; it eventually became a recursive abbreviation for PHP: Hypertext Preprocessor). Several languages -- Perl, Python, and even exotica like Scheme and Icon -- can do what PHP does: compute HTML pages on the server side of a Web application. PHP is unique, though, in that it is specifically designed to simplify that one task. You might reasonably expect, then, that PHP does it best. That certainly seems to be the belief of the few hundred thousand developers worldwide who are now enjoying the fourth major PHP release.



Take a moment to understand clearly what server-side computation means for a Web application. A minimal Webpage might have source that looks like this:




      <HTML>


          <HEAD>


                 <TITLE>


                      Home page for John Smith


                 </TITLE>


          </HEAD>


             <BODY>


                 This is John Smith's first home page.


             </BODY>


      </HTML>



Suppose now, that John wants to replace

This is John Smith's first homepage.

with

This is John Smith's first homepage.
John has completed XXXX Webpages.

One way to accomplish this would be for John to simply edit in "one" or "two" or n in place of XXXX. This works well enough for text that changes infrequently.



If John's a busy fellow, though, he'll likely want to "automate" his page -- that is, have the computer itself figure out parts of its content. At that point, his page will become dynamic.



If dozens of languages can generate dynamic Webpages, how do you choose among them? My first criterion is the social one: if your friends and colleagues are comfortable with PHP, then you should try it. While languages differ profoundly in a technical sense, most of them have roughly the same capabilities for introductory and intermediate-level Web work. Let computing specialists argue the details of syntactic theory; if you just want to get work done, use the same language that those around you use.



Often, that language is PHP. PHP is probably available for the Web server you use. It's easy for beginners to pick up. It has a helpful community of

I like it!
Post a comment
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
Free books

Essential JavaFX
Get started building rich Web apps quickly with an introduction to the power of JavaFX key features -- scene node graphs, nodes as components, the coordinate system, layout options, colors and gradients, custom classes with inheritance, animation, binding, and event handlers.Enter now!

The Nomadic Developer
Consulting can be hugely rewarding, but it's easy to fail if you are unprepared. To succeed, you need a mentor who knows the lay of the land. Aaron Erickson is your mentor, and this is your guidebook. Enter now!

Featured Sponsor

AISO founders envisioned a Web hosting company that was environmentally friendly. While the company employed energy-efficient innovations like solar panels, its infrastructure produced unacceptable power and cooling requirements. Find out how AISO leveraged AMD technology to overcome their challenge in this case study white paper.

In this whitepaper, Scalar explores the opportunity to change the landscape with respect to mission critical databases built around Oracle. Leveraging technologies such as Linux, high-end commodity processing power and Oracle RAC technology to architect, design, build and maintain database infrastructure that delivers maximum availability, reliability and performance at a fraction of traditional cost.

On a typical day, weather.com, the Web site for The Weather Channel in Atlanta, serves up between 15 million and 20 million page views. But in September 2004, when back-to-back hurricanes ransacked Florida, the peak traffic on one day more than tripled: over 70 million page views by more than 7 million unique visitors. Read the full success story now.

Marketplace