What is PHP?
Explained at a very basic level, PHP is a programming language you can use to create 'automated' web pages. Using PHP you can write everything from simple page counters to automated sites like AmIHotOrNot or the gameplay forums.
PHP scripts (programs) are executed by the web server itself when your web browser requests a page. They generate static HTML which is sent to your browser - as a result the web browser never sees any PHP code (it is dealt with by the server) and thus PHP scripts work fine with ANY browser, provided the HTML the script generates can be viewed by that browser.
Still confused? Check out the beginner's tutorial on the official PHP website:
If you want to build a website using PHP it is essential that your web site host supports PHP - free hosts that offer PHP include F2S and UK Linux.
note: f2s.com will be discontinuing free hosting in February 2002.
[added by the freakysid with apologies to Skunk]
What about mySQL?
PHP and mySQL are often mentioned in the same sentence, however they are completely different things. mySQL is a database system (like Microsoft Access but without the complicated windows interface or the hefty price tag). The PHP language has built in functions for "talking" to mySQL databases, and since mySQL (like PHP) is completely free they are a very popular combination. Using a mySQL database makes it very easy to create sites that store large amounts of information - such as the gameplay forums or an automated articles system.
Before you start learning PHP you need to have somewhere to run it. A free account at F2S or UK Linux will suffice, but an even better option is to install your own PHP web server on your windows PC and run your scripts from there. You need the windows versions of Apache (a web server), PHP, mySQL and a script called phpMyAdmin which will help you easily create and administrate databases in mySQL. That lot may sound daunting but there is a .zip file available for download containing all 4 - simply unzip it onto your hard drive and away you go.
If you really want to install PHP and Apache yourself (which can be good experience) there is an excellent tutorial here:
You can get the bits and pieces from...
PHP is - in my opinion at least - an extremely easy language. If you have had any previous programming experience (up to that point that you understand what variables, arrays, if...then statements and loops are) you shouldn't have any problems at all picking up basic PHP syntax. Even if you don't have previous programming experience starting PHP is a great way to get some.
My personal favourite PHP tutorial anywhere is this one from SitePoint:
It starts with the very basics (installing PHP, what it does) and goes on to cover everything from basic programming principles to advanced usage of PHP and mySQL to create a fully databased site. I recommend printing the article out, but be warned it comes to around 111 pages...
Also worth looking at are the PHP 101 tutorials on DevShed:
Online tutorials are great but they can only go so far - in practise the quickest and easiest way to learn something like PHP (if you're prepared to shell out the money) is with a good book. Here are my personal recommendations:
PHP Essentials. This is the book I learned PHP from - it expects no previous experience and takes you through from the bare basics to creating a fully database driven e-commerce site (complete with information on how to encrypt credit card details). The only down side is that much of the stuff in this book is covered in the WebMasterBase tutorial mentioned earlier - however at £24.93 (which is pretty cheap for a computer book) this is definitely worth considering:
Professional PHP Programming. This is a BIG red PHP Bible from wrox publishing. Think of it as the ultimate PHP reference book - between this and the PHP manual there's very little you won't be able to figure out. This book isn't ideal for beginners, but is virtually essential once you've got past newbie level.
Other books worth investigating (i.e I haven't read them but they've been recommended by other people) include:
PHP: Fast and Easy Web Development
Beginning PHP4 Programming
PHP Developer's Cookbook
The PHP Manual
PHP is blessed with one of the best written, most comprehensive online manuals I've ever seen. The manual is available in several different formats, including a .zip file for download to your local machine. The most useful version is the fully searchable online manual at php.net - complete with user comments. All comments are "moderated" before they go on display on the site so the quality of information is extremely high - in fact I've often found the solution to a problem with a PHP function by browsing through the comments on that function's page in the manual.
Useful Tip: You can quickly look up ANY function in the manual by going to http://www.php.net/the_function_name
- i.e http://www.php.net/date
will show you the page in the manual covering the date() function. I use this all the time.
Once you've read through a tutorial or read a book the chances are you'll be thirsty for more. The following are useful PHP resources I've found since I started playing with PHP:
PHP Builder - this is the definitive PHP community site. You can learn a huge amount by just reading through the article archive on this site, and fresh content is posted several times a week.
Zend - the official site of the "Zend" engine, which is the lightning fast code interpreter used in PHP 4. The site also includes a wealth of PHP articles, tutorials and code snippets (my personal favourites are listed below).
Introduction to Classes
Session Handling with PHP 4
The PHP Base Library (phpLib). This is a library of functions that handle many essential but complicated routines used by the majority of database driven websites. Of particular interest are the user permissions / session management classes and the excellent template class - there is also support for a shopping cart system and a very useful database interaction class.
Be warned, phpLib is not for the faint hearted (the documentation on the site isn't very friendly). Luckily there are some excellent articles around on how to use the library:
Good list of PHP Tutorials
Installing and using phpMyAdmin
Migrating from PERL to PHP
DevShed's PHP Section
Finally... places to get pre-written PHP Scripts
PHP Resource Index (my personal favourite)
PHP Wizards - home of phpMyAdmin among others