<HTML ><HEAD ><TITLE >A simple tutorial</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Getting Started" HREF="getting-started.html"><LINK REL="PREVIOUS" TITLE="What can PHP do?" HREF="intro-whatcando.html"><LINK REL="NEXT" TITLE="Your first PHP-enabled page" HREF="tutorial.firstpage.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="chapter" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="intro-whatcando.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="tutorial.firstpage.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="chapter" ><H1 ><A NAME="tutorial" >Chapter 2. A simple tutorial</A ></H1 ><DIV CLASS="TOC" ><DL ><DT ><B >Table of Contents</B ></DT ><DT ><A HREF="tutorial.html#tutorial.requirements" >What do I need?</A ></DT ><DT ><A HREF="tutorial.firstpage.html" >Your first PHP-enabled page</A ></DT ><DT ><A HREF="tutorial.useful.html" >Something Useful</A ></DT ><DT ><A HREF="tutorial.forms.html" >Dealing with Forms</A ></DT ><DT ><A HREF="tutorial.oldcode.html" >Using old code with new versions of PHP</A ></DT ><DT ><A HREF="tutorial.whatsnext.html" >What's next?</A ></DT ></DL ></DIV ><P > Here we would like to show the very basics of PHP in a short simple tutorial. This text only deals with dynamic webpage creation with PHP, though PHP is not only capable of creating webpages. See the section titled <A HREF="intro-whatcando.html" >What can PHP do</A > for more information. </P ><P > PHP-enabled web pages are treated just like regular HTML pages and you can create and edit them the same way you normally create regular HTML pages. </P ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="tutorial.requirements" ></A >What do I need?</H1 ><P > In this tutorial we assume that your server has support for PHP activated and that all files ending in <TT CLASS="filename" >.php</TT > are handled by PHP. On most servers this is the default extension for PHP files, but ask your server administrator to be sure. If your server supports PHP then you don't need to do anything. Just create your <TT CLASS="filename" >.php</TT > files and put them in your web directory and the server will magically parse them for you. There is no need to compile anything nor do you need to install any extra tools. Think of these PHP-enabled files as simple HTML files with a whole new family of magical tags that let you do all sorts of things. </P ><P > Let's say you want to save precious bandwidth and develop locally. In this case, you'll want to install a web server, such as <A HREF="install.apache.html" >Apache</A >, and of course <A HREF="http://www.php.net/downloads.php" TARGET="_top" >PHP</A >. You'll most likely want to install a database as well, such as <A HREF="http://www.mysql.com/documentation/" TARGET="_top" >MySQL</A >. You can install these individually or a simpler way is to <A HREF="http://www.hotscripts.com/PHP/Software_and_Servers/Installation_Kits/" TARGET="_top" >locate a pre-configured package</A > that automatically installs all of these with just a few mouse clicks. It's easy to setup a web server with PHP support on any operating system, including Linux and Windows. In linux, you may find <A HREF="http://www.rpmfind.net/" TARGET="_top" >rpmfind</A > helpful for locating RPMs. </P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="intro-whatcando.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="tutorial.firstpage.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >What can PHP do?</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="getting-started.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Your first PHP-enabled page</TD ></TR ></TABLE ></DIV ></BODY ></HTML >