downloads | documentation | faq | getting help | mailing lists | reporting bugs | sites | links | my 
search for in the  
<What can PHP do?Your first PHP-enabled page>
view the version of this page
Last updated: Thu, 21 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 support for PHP activated 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 don't need to do anything. Just create your .php 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. Most web hosts offer PHP support but if your host doesn't consider reading the PHP Links section for resources on finding PHP enabled web hosts.

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 Apache, and of course PHP. You'll most likely want to install a database as well, such as MySQL. You can install these individually or a simpler way is to locate a pre-configured package 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 rpmfind and PBone helpful for locating RPMs.

add a note add a note User Contributed Notes
A simple tutorial
25-Oct-2003 01:08
More for OS X Users,

The book "Mac OS X" by J. Ray and W. Ray has a good chapter on gettng PHP going on OS X 10.2.  PHP is already installed on OS X 10.2.  It just requires  some changes in the configuration file for Apache. has MySQL 4.0 available for download for OS X as a dmg file, which is very easy to install.

I wouldn't try this if you are a novice, but if you have experience using the terminal, databases, and a scripting language, this is a quick and easy way to start learning PHP and MySQL.  I was able to get a page on the server that accessed a database in MySQL in a few hours of work.  Be careful of security measures.

I am not sure if PHP is on 10.3, but I assume it will be.  It is not on versions before 10.2.
28-Sep-2003 10:25
Mac OS X users,

a good place to start is with this site:
then you can get the Complete PHP , Complete Apache2, and Complete MySQL packages.
please note the default Apache in OS X is 1.3.27 so enabling Apache2 you don't turn on SystemPref>>Sharing>>PersonalWebSharing. consult the  docs that come with the downloads. It's pretty easy to do. all install nicely and are enabled. They install into /Library/Apache2, /Library/MySQL/ and /Library/PHP4/   
the Install Guide.pdf for each package documents the installs excellently. and the Apache2 and MySQL packages come with a preference pane to easily control the starting of the msqld and apache2 webserver.
So do yourself a favour. use the ServerLogistics packages.

<What can PHP do?Your first PHP-enabled page>
 Last updated: Thu, 21 Aug 2003
show source | credits | sitemap | mirror sites 
Copyright © 2001-2003 The PHP Group
All rights reserved.
This mirror generously provided by:
Last updated: Sat 01 Nov 2003 04:13:36 EST EST