PHP  
downloads | documentation | faq | getting help | mailing lists | | php.net sites | links | my php.net 
search for in the  
<What can PHP do?Your first PHP-enabled page>
view the version of this page
Last updated: Sat, 09 Aug 2003

Chapter 2. A simple tutorial

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 What can PHP do for more information.

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.

What do I need?

In this tutorial we assume that your server has activated support for PHP and that all files ending in .php 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 do not need to do anything. Just create your .php files, put them in your web directory and the server will automatically 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. Most web hosts offer PHP support, but if your host does not, consider reading the PHP Links section for resources on finding PHP enabled web hosts.

Let us say you want to save precious bandwidth and develop locally. In this case, you will want to install a web server, such as , and of course PHP. You will most likely want to install a database as well, such as .

You can either install these individually or choose a simpler way. Our manual has installation instructions for PHP (assuming you already have some webserver set up). In case you have problems with installing PHP yourself, we would suggest you ask your questions on our installation mailing list. If you choose to go on the simpler route, then for your operating system, which automatically installs all of these with just a few mouse clicks. It is easy to setup a web server with PHP support on any operating system, including MacOSX, Linux and Windows. On Linux, you may find and helpful for locating RPMs. You may also want to visit to find packages for Debian.



add a note add a note User Contributed Notes
A simple tutorial
simonpointer at bigi dot co dot uk
28-Sep-2004 08:35
With such a wide array of choices for web applications, making the right one sometimes seems daunting.

I like the hammer analogy, but in my experience there are quite a few who think they need a large hammer like J2EE and java, when a PHP, mySQL solution would work just as well. I mean, it supports 60,000 tables and many terabites of data - how much data and complexity do you think you have?

I once worked for a large corporate that chose the J2EE route (a good choice for many reasons). However, we soon found hardware and development costs to be quite high. We found development slower and more complex, and that we rarely needed or used the power afforded by the J2EE solution. In many developments we had to scale back to a simple .jsp solution to make development more cost effective. If your not sharing lots of functionality on an enterprise scale, you probably don't need a J2EE style hammer.

Remember once your in one boat, it's not always easy to jump ship mid ocean! Make a good choice to start with. Scaling up is easier and more cost effective, than scaling down.
charles dot tse at chumsnet dot com
25-Sep-2004 02:04
Obviously, different tools are good for different things:

Microsoft ASP.NET are definitely good for alleviating the fear from those who don't know technology, and yet want a "safe bet" feeling, by relying on the big name.  Managers, finance guys, and decision makers often fall into the never-ending spending spree as a result.  But, beautiful user interface, and integration to Microsoft suite of applications are unquestionable.

If you want something scalable, secure, maintainable, capable of handling complicated logics/flow, suitable for large team development, then JSP, Struts, Java, and J2EE will be the definitely choice.

But, if simplicity, speed of development, and economy are important factors, then PHP should be the bet.

Anyone trying to hammer all things with the same hammer are doomed to fail.

<What can PHP do?Your first PHP-enabled page>
 Last updated: Sat, 09 Aug 2003
show source | credits | sitemap | contact | advertising | mirror sites 
Copyright © 2001-2004 The PHP Group
All rights reserved.
This unofficial mirror is operated at: /
Last updated: Sun Nov 14 23:09:54 2004 Local time zone must be set--see zic manual page