Index   -   Next  >


PHP Introduction


Personal Home Page (For Idiots)

PHP Hypertext Preprocessor

A server-side embedded scripting language originally created by Rasmus Lerdorf in 1994. PHP has changed extensively since then.

A PHP web page is a file containing HTML interspersed with PHP script. the PHP script is executed on the server and the resulting HTML sent to the client - very similar to ASP.

PHP syntax has much in common with Java, JavaScript, Python and Perl. It is designed with the express intention of making server scripting easy to code.

PHP scripts can run as a Common Gateway Interface (CGI) application

Can run as an Apache module

PHP can also run from the command line. This has gained some popularity so the command line interpreter is now built by default.

PHP is an Open Source product which from PHP3 onward is based on the Zend scripting engine - designed to be easily embeddable and provide high performance. Zend, a commercial company, and the Open Source community enjoy a symbiotic relationship. Development, testing, bug fixing and feedback from the community being incorporated into Zend's highly professional softwares.

PHP4 emerged in 2000 and PHP5 in 2004, the latest version is PHP 5.2.4. The Unix Apache webserver stuweb.cms.gre.ac.uk runs 5.0.5 and the Windoze IIS server cms-stu-iis.gre.ac.uk runs 5.2.3 (the Windoze Apache server stuapache.cms.gre.ac.uk is currently not working). Don't be too surprised at differences between your domestic installation and the University servers.

These notes are suitable for both PHP4 and PHP5. Amongst other improvements PHP 5 provides an improved implementation of DOM and we will use this when we look more closely at XML.

What do you need to experiment with PHP?

Using PHP with the Apache webserver

The natural home for PHP is a Unix/Linux platform runing Apache. The unix notes provide a Unix perspective.

Windoze distributions are usually precompiled binaries, which is an endorsement of one strength of the Win32 platform - there are only 4 major versions to cope with and frequently a single software build can suit all four.

The configuration concepts are however pretty much the same for each platform so regardless of the platform on which you are running there are a couple of configuration files that it is a good idea to have a look at and modify to suit your needs:

httpd.conf - the main apache config file
php.ini - the main PHP config file

If you are running Win32 then there are some excellent notes provided by the good people at ricocheting. And don't forget - PHP is happy to run with the Micro$oft IIS server and if you install more than one webserver on a machine then they cannot all use port 80.

To test your installation create a PHP file containing a single line of code.

<?php phpinfo() ?>

This should produce a lot of output telling you all about your PHP installation

Books:

the Wrox books make it seem so easy (but they are usually out of print)
Plenty of online documentation (don't think about printing it - over 1600 pages!).


Index   -   Next  >

best viewed using Mozilla browsers
© k.mcmanus 2004
Valid XHTML 1.! . Valid CSS . WCAG priority 3 approved