Friday, July 20, 2007

An Introduction to PHP

(This is a guest author article.)

Learning any computer programming/scripting language isn't hard as long as you follow the proper learning steps.

Today I want to talk about PHP. PHP stands for "PHP: Hypertext Preprocessor". Part of that is kind of redundant, isn't it? Here's why: PHP/FI, the first version, was created by Rasmus Lerdorf in 1995. PHP/FI stood for "Personal Home Page / Forms Interpreter". So the "PHP" part of that is now included for recognition purposes only.

PHP/FI was based on Perl scripts. As it grew in complexity, C functionality was added and version 2 was produced. Eventually, PHP3 was released and that's when it really took off with developers. Believe it or not, there are still some servers (but very few) out there running that version of PHP. PHP4 is still the most commonly used version today, even though PHP5 has been in existence since July of 2004.

On July 13, 2007, the PHP development team announced the end-of-life for PHP4 as December 31, 2007, with critical security fixes until August 8, 2008. Now would be a good time to migrate the servers and software to PHP5. PHP6 is in development now.

The comprehensive manual at PHP: Hypertext Preprocessor includes a "hello world" tutorial that can familiarize you with the basic steps to getting it working on any web site. Fortunately most blog, CMS, and forum software already has it all in place. But what if you want to change something or add some functionality the software doesn't include? Unless you know what you're looking for, and what you're looking at means, it might as well be a foreign language to you. That's where a "sandbox" version of your web site comes into play. That's usually how I make major changes to my blog at Untwisted Vortex.

Most Linux distributions include everything you need to set up a server on your own PC, including the PHP implementation. All you have to do make sure it only points to your PC's server IP address (usually 127.0.0.1). On Windows, it's a little harder. I recommend using XAMPP for Windows. I've tried just about every Windows-based web server there is at one time or another, and I think this package is the best choice. XAMPP is an acronym that spells out what it includes (except for the X): Apache web server, MySQL database server, PHP interpreter and Perl interpreter. Once you set it all up, it's just a matter of playing with the code on web pages you design.

I'm sorry, but I'm not familiar enough with other operating systems to even guess what package would be the best to use. There is, however, a XAMPP version for Linux, Mac OS X and Solaris, in addition to the Windows version.

That's enough for one day. I can only suggest, if this interests you at all, is to do a lot of reading before the next article I publish on the subject. That will probably happen tomorrow.

(Update 2007-07-29: I was tied up with other things and my next article should be today.)