Website Development & Management Getting Ready for the Server-Side CIT Fall Instructor: John Seydel, Ph.D.
Student Objectives Upon completion of this class meeting, you should be able to: Install PHP-related development software Create simple web forms
First, Let’s Resolve Some SSI and Other IssuesSSI Your PHP repertoire, so far Script delimiters Variables Naming Assigning string literals Functions echo() include() First and second tier SSI versions Modify footer to include link home Questions/problems? XML declaration Other...
Now, an Intro to Forms Forms are what made eCommerce feasible Get info from user Display info back to user That is, they add interactivity ! Working with forms involves Forms page Forms processor, either Client-side or Server-side, or Both (local validation then server-side processing)
HTML Forms in Brief At lowest level, a form consists of two elements: Form The overall container element Input data collection control A variety of types (textboxes, checkboxes, buttons, etc.) exist and are designated by the type attribute Example: Class: Several other data collection controls exist
Getting Started with Forms Main element is Attributes: id (for object references in scripts) action (where the form processor is) method (usually post but sometimes get) Should be only one per page (for our purposes) All controls must be within... Form controls input (many types) button select textarea Forms also typically contain standard inline (e.g., ) and block (e.g., ) elements
Basic Forms Example Suzy Student GuestbookGuestbook Look at the tags Elements Attributes Note the action attribute This is the form processor Use any URL, including However, submission is very undependable
Our PHP Environment (LAMP) The components Operating system Linux (production machine) LAMP Windows (development machine) WAMP MySQL: the DBMS and server Apache: the web server PHP: the scripting engine For best results, install in that order Before downloading Make sure you have administrator permissions Stop IIS if it’s running Create a desktop folder Downloads
The Installation Process: MySQL Generally follows procedure given in Meloni textbook Download mysql win.zip from course Handouts page (or from MySQL.com) into Downloads directory Uncompress into a default temporary directory and then open that directory Double-click on SETUP.EXE and accept all defaults as the installation wizard runs Test the installation Run c:\mysql\bin\winmysqladmin.exe Provide a username and password you’ll remember (generally, these won’t be used again, ever) Note the stoplight now on taskbar at bottom right MySQL’s database server now starts upon bootup For now, go no further (i.e., not beyond p. 8)
The Installation Process: Apache Again, ensure that IIS is stopped Also follows procedure given in Meloni textbook but with some variations; assumes you’ll be installing PHP right away Download apache_ win32-x86-no_ssl.msi from course Handouts page (or from Apache.org) into Downloads directory Double-click on apache_ win32-x86-no_ssl.msi Accept defaults as the installation wizard runs Don’t worry for now about Server Information panel Verify the installation Note the feather icon near the right end of the taskbar Point browser to (output displayed on p. 29 should appear) Modify the configuration...
Modifications to Apache Edit the configuration file: c:\Program Files\Apache Group\Apache2\conf\httpd.conf Specify server settings: Find ServerAdmin statement and set the argument to your address Find ServerName statement and set the argument to your IP address or to Two more changes: Add to the end of the LoadModule section LoadModule php5_module c:/php/php5apache2.dll Add to the end of the AddType section AddType application/x-httpd-php.phtml.php Do not restart Apache until after installing PHP
The Installation Process: PHP Varies somewhat from procedure given in Meloni textbook Download php Win32.zip from course Handouts page (or from PHP.net) into Downloads directory Uncompress into a permanent directory (c:\php) and then open that directory Configure PHP (see next slide) Restart Apache Click on taskbar icon (feather) Then Apache2 | Restart
Configuring PHP Make changes to files Copy c:\php\php.ini-dist to c:\WINDOWS Rename c:\WINDOWS\php.ini-dist to c:\WINDOWS\php.ini Edit c:\WINDOWS\php.ini Open in NotePad Find and uncomment (remove “;”) extension=php_mysql.dll Find and set error reporting configuration error_reporting = E_ALL & ~E_NOTICE display_errors = On Setup for (example) SMTP = smail.astate.edu sendmail_from = Save and close the file Copy c:\php\php5ts.dll to c:\WINDOWS\system Copy c:\php\ext\php_mysql.dll to c:\WINDOWS\system Copy c:\mysql\bin\libmysql.dll to c:\WINDOWS\system Restart Apache
If Modifications are Needed Apache: Modify the httpd.conf file and then restart Located in C:\Program Files\Apache Group\Apache2\conf PHP: Modify the php.ini file and then restart Apache Located in C:\WINDOWS MySQL: we’ll address this later
Summary of Today’s Objectives Create simple web forms Install PHP-related development software
Appendix
Browser/Server Interaction
Server-Side Include Exercise Locally, make 4 copies of index.html index.php header1.shtml header2.shtml styles1.shtml Edit these files, save them, and post them to SuSE1 header1.shtml: remove all before and after footer1.shtml: remove all before and after last styles1.shtml: remove all before and after index.php (first remove XML directive, for now) Remove all between and inclusive Insert: Remove all between and inclusive Insert: Remove all between and last inclusive Insert: