Installing and Configuring a Web Server
PHP is a Web programming language, similar to JavaScript in that it’s not an object-oriented programming language. The big differentiator between the two is that PHP allows us to take data from a Web page and place it in a database. In reverse, we can also take data from a database and place it on a Web page. You can also do this with ASP (Active Server Pages), but PHP provides much more functionality, as you shall see. Like JavaScript, PHP is based on the ‘old’ programming language of C.
As with the JavaScript programming language, capitalization, parentheses, and quotation marks (single and double) are used and how you use them determines whether your code works (or not). Pay close attention to your typing and scan for errors as your first line of defense when your code does not function as expected.
PHP is a strange name for a programming language. When it originated, it meant Personal Home Pages, but then became a strange occurrence – a self-referencing acronym – when folks began to call it PHP Hypertext Processor (which is PHP referred to within the PHP acronym). Strange, wouldn’t you say?
The authoritative Web site for PHP can be found at http://us.php.net/history. You should bookmark this site and look there for answers to problems you encounter.
As mentioned above, you don’t need to install PHP on your home computer if you don’t want to do that. I suggest that you do as if you don’t, you won’t be able to run PHP code unless you’re connected to the Internet. Chapter 2 outlines what you need to do to install PHP on your computer. However, if the install takes more than a couple of hours or so, I’d save that task for another day (like next summer).
Keep in mind that when the PHP engine is installed you also need a Web server under which to run it. This means that you will need to turn your computer into a Web server. You have two good options available to make this possible. One option is to install the Apache server on your computer. I have a program (I believe it’s still on the school’s “i” drive) that installs PHP v5.0 and Apache in one install package. You are welcome to try this if you want to do that. You can install Apache on Windows XP Pro. I’d check Apache’s Web site for a Vista version if you’re running that OS.
Since I’m a Microsoft sort of guy, I prefer the second option, which is to enable IIS (Internet Information Services) in Windows XP. You can use IIS instead of Apache and again, chapter 2 outlines how to do that. Remember too that Apache is Unix-based and IIS is Microsoft-based. You install IIS as you would any other Windows Component (through the Control Panel / Add/Remove Programs / Add/Remove Windows Components). Once you install IIS, it shows up with your other Admin tools under the Control Panel / Administrative Tools link. Windows XP can use IIS v6.0 whereas Vista shipped with IIS v7.0.
Windows XP can act as a Web server and can host one (and only one) Web site. This comes in handy when you’re on a company LAN and you want your own personal Web site (you might need one for your work, which isn’t as uncommon as you might think). If you install IIS on a Windows Server, then the server can host thousands of Web sites. Of course, you must also install PHP on the server so that PHP code can be understood (refer to page 53). A great primer for understanding IIS can be found at http://en.wikipedia.org/wiki/Internet_Information_Services. In case you need it, here’s a good URL for installing IIS in Windows XP Pro: (http://www.webwizguide.com/kb/asp_tutorials/installing_iis_winXP_pro.asp). Microsoft’s IIS Web site URL is http://www.iis.net/default.aspx?tabid=1.
In addition to PHP and Web server ability (IIS or Apache), you also need a database for use by your Web site. Most people today are using the free MySQL database engine. Their Web site URL is http://www.mysql.com/, and you will want to bookmark this site as well. You can download the install program from this Web site too if you want to install it on your computer.