Title: Website Development
1Website Development Management
CIT 3353 -- Fall 2006 www.clt.astate.edu/jseydel/m
is3353
- Getting Ready for the Server-Side
Instructor John Seydel, Ph.D.
2Student Objectives
- Upon completion of this class meeting, you
should be able to - Install PHP-related development software
- Create simple web forms
3First, Lets Resolve Some SSI and Other Issues
- 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 . . .
4Now, 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)
5HTML Forms in Brief
- At lowest level, a form consists of two elements
- Form
- ltformgt
- The overall container element
- Input data collection control
- ltinputgt
- A variety of types (textboxes, checkboxes,
buttons, etc.) exist and are designated by the
type attribute - Example
- ltform actionformproc.php methodpost
idfrmDemogt - ltpgtClass ltinput typetext nametxtClass /gt
lt/pgt - ltpgtltinput typesubmit valueDisplay
Assignment /gt lt/pgt - lt/formgt
- Several other data collection controls exist
6Getting Started with Forms
- Main element is ltformgt
- 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 ltformgt ... lt/formgt
- Form controls
- input (many types)
- button
- select
- textarea
- Forms also typically contain standard inline
(e.g., ltemgt) and block (e.g., lttablegt ) elements
7Basic Forms Example
- Suzy Student Guestbook
- Look at the tags
- Elements
- Attributes
- Note the action attribute
- This is the form processor
- Use any URL, including email
- However, email submission is very undependable
8Our 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 its running
- Create a desktop folder Downloads
9The Installation Process MySQL
- Generally follows procedure given in Meloni
textbook - Download mysql-4.0.24-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 youll remember
(generally, these wont be used again, ever) - Note the stoplight now on taskbar at bottom right
- MySQLs database server now starts upon bootup
- For now, go no further (i.e., not beyond p. 8)
10The Installation Process Apache
- Again, ensure that IIS is stopped
- Also follows procedure given in Meloni textbook
but with some variations assumes youll be
installing PHP right away - Download apache_2.0.54-win32-x86-no_ssl.msi from
course Handouts page (or from Apache.org) into
Downloads directory - Double-click on apache_2.0.54-win32-x86-no_ssl.msi
- Accept defaults as the installation wizard runs
- Dont worry for now about Server Information
panel - Verify the installation
- Note the feather icon near the right end of the
taskbar - Point browser to http//127.0.0.1 (output
displayed on p. 29 should appear) - Modify the configuration . . .
11Modifications to Apache
- Edit the configuration file
- c\Program Files\Apache Group\Apache2\conf\httpd.c
onf - Specify server settings
- Find ServerAdmin statement and set the argument
to your email address - Find ServerName statement and set the argument to
your IP address or to 127.0.0.1 - 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
12The Installation Process PHP
- Varies somewhat from procedure given in Meloni
textbook - Download php-5.0.4-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
13Configuring 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 )
extensionphp_mysql.dll - Find and set error reporting configuration
- error_reporting E_ALL E_NOTICE
- display_errors On
- Setup for email (example)
- SMTP smail.astate.edu
- sendmail_from JoJo.Beans_at_smail.astate.edu
- 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
14If 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 well address this later
15Summary of Todays Objectives
- Create simple web forms
- Install PHP-related development software
16Appendix
17Browser/Server Interaction
18Server-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 lth1gt and after
lt/h1gt - footer1.shtml remove all before lthr /gt and
after last lt/pgt - styles1.shtml remove all before ltstylegt and
after lt/stylegt - index.php (first remove XML directive, for now)
- Remove all between ltstylegt and lt/stylegt inclusive
- Insert lt? include("styles1.shtml") ?gt
- Remove all between lth1gt and lt/h1gt inclusive
- Insert lt? include("header1.shtml") ?gt
- Remove all between lthr /gt and last lt/pgt inclusive
- Insert lt? include("footer1.shtml") ?gt