Home | Hardware | Internet News |Web Hosting |IT Management |Network Storage
LinuxPlanet
Search 
  Power Search | Tips 

 Front Door
 Discussion
 LinuxEngine
 Opinions
 Reports
 Reviews
 Tutorials
 News
 Technology Jobs

 Browse by subject.
Free Newsletter

Linux Planet
Linux Today
More Free Newsletters

Be a Commerce Partner

Web Design
Send Text Messages
Holiday Gift Ideas
Server Racks
Laptops
Corporate Gifts
Promotional Gifts
Compare Prices
Calling Cards
Domain registration
Auto Insurance Quote
Memory Upgrades
Dental Insurance
Imprinted Gifts



internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Print this article
Email this article
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers. Download this whitepaper now and get a chance to receive FREE XenServer HP Select Edition Software. Sponsored by HP, Citrix, and Intel.

   LinuxPlanet / Tutorials



  Managing the Modern Network
Sponsored by HP
In a global economy where information crosses the globe in an instant, and where Web-based applications power business, it's more important than ever to ensure your network is safe from threats and optimized to deliver the data your business needs. »
 
  Business Service Management: Generate Revenue Through IT
Sponsored by HP
IT must now help organizations attract, retain and grow customer relationships and increase customer satisfaction. Business service management (BSM) helps lay the foundation by managing services in dynamic support of business requirements. Learn more. »
 
  Evaluating Software as a Service for Your Business
Sponsored by Webroot
Is Software as a Service just hype, or is something really going on here? See if your company can benefit as SaaS tries to change the face of the enterprise. »
 
  Storage Networking: Configuration and Planning
Sponsored by HP
The most critical part of setting up a SAN is configuring each individual disk array. This guide examines configurations for SAN-attached servers and disk arrays, and looks at the future of IP storage. »
 
  Is Your Disaster Recovery Plan Good Enough?
Sponsored by HP
Preparing for a disaster is more often than not part of the storage planning process, and it is one of the most difficult tasks, since it includes local hardware and software, networking equipment, and a test plan. Learn how to get disaster recovery right. »
 
Adding PHP to Apache on Linux
Supercharging Your Web Pages

Ken Coar
Thursday, December 23, 1999 07:46:09 AM

Editor's note: With this debut column, Ken Coar joins LinuxPlanet as a monthly columnist. Coar's background as a pioneer in the open-source community is impressive, as a member of the Apache Group and a director and vice president of the Apache Software Foundation. He is also a core member of the Jikes open-source Java compiler project, a contributor to the PHP project, the author of Apache Server for Dummies, and a contributing author to Apache Server Unleashed.

The technology that supports the Web continues to evolve, and one of the latest mutations involves capitalising on its very user-driven interactivity. The days of all-static content are past; the Web has evolved to a point at which many sites actually remember personal preferences for each of their (potentially millions) of visitors. News sites may display stories in only those categories you find interesting; online music stores can provide you with listings of new works sorted in order by your favourite artists; Web search engines can learn to implicitly restrict the types of content they'll list for you. The possibilities are endless, and the key is generating a unique presentation for each viewer.

There are a number of ways of accomplishing this, from the primitive fly-swatter capabilities provided by "server-side includes" to the tactical nuke Extra Strength features found in application servers. The PHP scripting language falls somewhere into the middle ground, supplying phenomenal capabilities for free.

What is PHP?

PHP is a scripting language, with a particular affinity for and emphasis on enhancing Web pages. It has a syntax very similar to C (with a smattering of Perl and shell), and includes lots and lots of functions for things like database access, dealing with CGI requests, and image creation and manipulation.

When PHP is used as an Apache module, and the language elements are embedded in the document pages themselves, the HTML file might look something like the following:

    <head>
     <?
         //
	 // Preload all the functions and other definitions we need.
	 //
	 include("$DOCUMENT_ROOT/scripts/definitions.php3");
	 $pdetails = lookup_visitor();
	 echo "  <title>WhizBang Products: Welcome back, "
	     . $pdetails["first_name"] . "!</title>\n";
     ?>
    </head>
    <body bgcolor="#ffffff">
     <h1 align="center">Super-Duper Whizbang Products</h1>
     <h2 align="center">Welcome back,
      <? echo $pdetails["first_name"] . " "
             . $pdetails["last_name"]; ?></h2>

When a Web client requests a PHP-enabled page, the mod_php module gets to interpret the document and make changes to it before the Web server itself sends the results back. The results of the above PHP fragments might cause the following to be what the Web client actually receives:

    <head>
     <title>WhizBang Products: Welcome back, Ken!<title>
    </head>
    <body bgcolor="#ffffff">
     <h1 align="center">Super-Duper Whizbang Products</h1>
     <h2 align="center">Welcome back, Ken Coar</h2>

Notice how all the stuff between "<?" and "?>" was replaced—interpreted by mod_php—before it reached the browser? That's part of the power of PHP.

Next: Assumptions in This Article »

Skip Ahead

1 Supercharging Your Web Pages
2 Assumptions in This Article
3 How to Get PHP
4 PHP Extensions
5 Building PHP for CGI Use
6 Building PHP as an Apache Module
7 Building mod_php as a Dynamically Loaded Object
8 Testing Your Installation
9 Going Further/In Conclusion
10 Appendix A: Building Apache at Lightspeed
11 Appendix B: Apache Source Components Provided by Linux Distributions
12 Appendix C: Fixing Red Hat 6.1's apxs Script





Linux is a trademark of Linus Torvalds.


internet.com home | search | help! | about us

Jupiter Online Media

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers