★ wanayoo — archive 1999 http://webdevelopersjournal.com/articles/php.htmlNouvelle recherche | Portail wanayoo
Back to the Web Developer's Journal Main Page
internet.com
side nav bar
PHP - a free alternative to Cold Fusion or ASP?
Related Articles:



HOW DID THEY DO THAT???

Find out in:
Amazing HTML



Search Our Site:
WDJ Mailing List:
Ask the JavaScript Weenie:
Discussion:


For news and reviews of the latest computer audio tools, visit: The Tapeless Studio
Discussion Groups Book Reviews Software Reviews Download Web Tools
A free alternative to Cold Fusion or ASP?

PHP 3.0

by Ted Brockwood

Ask most Web application developers their scripting language of choice, and you'll find that most are divided into two camps - the Microsoft Active Server Pages (ASP) folks, and the Cold Fusion users. If you do a little more research however, you'll find there are other options out there, and one of these, PHP 3.0, is in much wider use than one would think for an "alternative product".
January 27, 1999
A recent survey (http://www.php.net/usage.php3) places the number of domains using PHP 3.0 at over 270,000. That's not bad for a completely free scripting language that doesn't even market itself against Microsoft or Allaire.

So what exactly is PHP? At its simplest, PHP is a server-side, cross-platform embedded HTML scripting language. With PHP, you can perform both simple and complex functions with a few lines of additional code. PHP scripting allows you to do everything from "Hello World" popups to database-driven search engines. One of the best things about PHP is that it's totally free, even for those running it on commercial operating systems such as Windows NT.

The PHP scripting language is a hybrid of Perl, Java, and C. Most Webmasters are fairly familiar with at least one of these languages, making PHP a quick language to learn. PHP is very database-friendly, as it can connect to Sybase, MySQL, mSQL, Oracle, and many others (including most ODBC-compliant databases).

PHP code is embedded in standard HTML. Documents must be assigned the ".php3" extension for the interpreter to recognize that they contain scripting. Once the document is properly named, the PHP engine will automatically run the scripts whenever the page is requested.

Looking for an example? Let's begin with the classic "Hello World" code. When a user requests this page, it will be generated as HTML, with the message "Hello World" embedded within it. To the end user, nothing out of the ordinary has happened. They simply requested a page.

First, create an HTML file and name it "hello.php3". Now, input the following lines:

<html><head><title>PHP Test</title></head>
     <body>
     <?php echo "Hello World<P>"; ?>
     </body></html>

Notice the "<?php" and "?>" tags? These let the Web server know that this is PHP code within the tags, and thus to let the PHP interpreter take over. Pretty effortless, right?

Let's get a little trickier. Let's slap together a form for processing. First, create your form page with the following code inside the standard HTML (and remember the ".php3" extension):

<form action="/old?u=http%3A%2F%2Fwebdevelopersjournal.com%2Farticles%2Faction.php3&y=1999" method="POST">
     Your name: <input type=text name=name>
     Your age: <input type=text name=age>
     <input type=submit>
     </form>

Next, create another page, named "action.php3". Again, just a standard HTML page but within the code you'll add:

Hi <?php echo $name?>. You are <?php echo $age?> years old.

Now, when the user submits your form, the variable data ($name and $age) are brought over to the results page (action.php3) by the PHP interpreter.

Most work within PHP is really this easy. Database connectivity is as uncomplicated as using Active Server Pages and/or Cold Fusion. PHP has three advantages over the aforementioned scripting languages:

  • Speed and robustness. Whereas ASP tends to slow down a Web server, PHP rarely suffers from such ills. PHP sites rarely, if ever, bog down under heavy loads (unless the server is already under-powered in general).
  • Cross-platform. If you're a Linux, FreeBSD, Solaris, Windows NT, IRIX, HP-UX., or Amiga user, you'll find a distribution of PHP.
  • Ease of use. PHP 3.0 uses a very simple and friendly style of code. Tagging your HTML with PHP scripts is the ultimate in ease, and learning the markup language itself is as effortless as with any other.
If you're a Webmaster in search of a good, easy-to-use scripting language, PHP 3.0 might just be the solution. With such wide (and free) availability, everyone should give it a try. And one last thing...it's Y2K compliant!

More information:

PHP Homepage: http://www.php.net

PHP-to-MySQL database tutorial: http://www.devshed.com/
resource/advanced/php3/intro/index.html

PHPBuilder.com: http://www.phpbuilder.com/

PX The PHP Code Exchange: http://px.sklar.com/

Ted Brockwood is the Information Services Manager for a real estate listing service in Oregon. His experience covers Java, Linux, UNIX, NT, Win95/98, Win3.x, and DOS.
Back to the Web Developer's Journal
Email to WDJ   •    Suits!   •    Propheads!   •    Ponytails!
Masthead   •    Subscribe   •    Search

internet.com
Internet News   Internet Stocks   Internet Technology   Web Developer
Internet Marketing   ISP   Downloads   Internet Resources   International  
Search internet.com   Advertising Info   Corporate Info   Internet Trade Shows
e-commerce
Be an Affiliate   Software Store   Travel   Banking   e-solutions   Internet Jobs
Bookstore   Shopping Carts   A/V Network   Schedule Meetings   Rent Email Lists
Press Release dist.   Sell Ad Space   Venture Capital   Research   Find an ISP
WebDeveloper Network
BrowserWatch   Java Boutique   JavaScript Source   ScriptSearch
SearchEngineWatch   StreamingMedia World   The WDVL   WebDeveloper.com
Developer Forums   Developer News   WebReference.com   The XML Files

Copyright 1999 internet.com Corp. All Rights Reserved. Legal Notices, Reprints.