PHP is an open-source programming language that forms a bridge between HTML and data that reside outside the HTML. While the origin of the PHP acronym is unclear (it may be the initials of the original developers), it is probably most illustrative to remember it as Pre-Hypertext Processor. Defining it this way makes clear the relationship between PHP and HTML. PHP does all of its work before the HTML is sent to the browser. In fact, it is a coding language that writes variable HTML on the fly (wow, a coding language that produces more code--how fun is that!) In the final HTML file that is sent to the browser, there is no evidence of the PHP that generated the code.
PHP is actually a general purpose programming language which has the capability to generate HTML. The capabilities of PHP are wide-ranging, and as is the nature of open source software, ever-expanding. It's most common use in relationship to HTML is to retrieve data stored in a MySQL database and use it on a web page. We will look at MySQL (SQL=Structured Query Language) in subsequant classes.
PHP is a server-side scripting language. This means that PHP sends commands not to the local browser, but to the web server. In order for this to work, the server administrator must install the PHP software and configure the server so that it understands PHP commands. Steve Strait at Intermedia has done this on the Intermedia3 server, so you will need to do your PHP testing on this server. One effect of the server-side configuration is that PHP pages will not work in the design pane of DreamWeaver or other web page design programs. Instead, you must first send your PHP page to the server, and then test by connecting to the URL through your browser. I believe that Dreamweaver has a way to set this up to work automatically, but I am not familiar with how to do this. I personally rely on copying the file to the server and then calling it up from its real URL address in a browser.
It is possible to set up your computer as a local server allowing you to test your PHP files locally without a connection to the web server. Doing so, however, is technically challenging and beyond the scope of this class. (If you are interested in doing this, you can download the PHP program from http://us.php.net/downloads.php)
You must save your file with ".php" on the end in order for the server to recognize it as containing PHP commands. With anything else on the end (".html" for example) the server will not interpret the PHP commands.
<<Return to Week | 1 | 2 | 3 | 4