Serving up pages on a PHP4 plate
Authors: Tim Converse, Joyce Park
Local distributor: Intersoft
Price: Around R384
Your first website project starts off well: Your pages (all four of them) are neat, attractive and there is not a broken link to be found. A few weeks later however, the exact opposite is true. First the boss wants a whole lot of new information posted on the site. Then he wants a product catologue put online. Then there is more company information to be posted on the website and perhaps even a company organogram. And just as you’ve given up all hope of ever regaining your social life, he starts mumbling about “upgrading” the look to be more “funky”. If you hadn’t already typed up your resignation letter, now would be the time to do it.
Websites built in straight HTML are usually one of two things: Very dull because no-one has time to keep the information up to date; or they are a minefiled of maintenance, ready to drive the poor soul entrusted with its care to drink or drugs.
The answer to most of these problems is some sort of server-side scripting and preferably a database and when it comes to this among the best tools for the job is PHP and either a PostgreSQL or MySQL databse. PHP, or the Hypertext Preprocessor, is an open source server-side scripting language which is both easy to use as well as being powerful enough to run even the most intense of websites.
Distributed under the GPL license, PHP can be downloaded for free from the internet at www.php.net. Learning to write PHP code is simple enough if you have some experience of programming. If, however, you have no experience of programming the PHP4 Bible could be what you’re looking for. The book is written in simple language with loads of examples as well as a fully explained project – a shopping site – in the latter pages.
The introduction guides readers through downloading PHP and installing it on their machine. When it comes to examples, preference is given to the Apache webserver and the MySQL database. Other applications get a customary mention.
The following chapters run readers through the basic language constructs, variable, data types, basic maths functions, strings and user-defined functions. Each of these areas are introduced in simple terms and most of them are supplied with examples of each function.
The real power of PHP comes in its strength in handling databases. This section offers a broad overview of relational databases, SQL and the basic MySQL functions available to PHP users.
Although all the examples use the mySQL database as a reference there is also an introductory section outlining The latter chapters concentrate on building an online shopping section by example. While the PHP4 Bible is good reference material for anyone new to PHP and ambitious to build dynamic websites, the more advanced users will find the book lacking in detail. The full extent of PHP4 is far too big to fully explain in just one book and if you’re looking for a desktop command reference you’ll be better off with something else.
PHP4 Bible sections:
Object-oriented programming by using PHP