Configuring Your Home Computer to Run Apache Server, PHP, MySQL, ColdFusion, and IIS
This tutorial for installing WAMP Server (Apache, PHP, MySQL, and phpMyAdmin) was written for the students in the Web Page Design program at the
Contra Costa ROP. This tutorial will cover basic server installation for web development
testing purposes on your
home computer. This tutorial
will not cover all of the necessary security settings used to create a
public web server.
We currently use three texts for web database development:
Macromedia Dreamweaver MX 2004 - ISBN 0-619-21420-1 - Covers Dreamweaver from the ground up. This text also includes an introduction to web database development using PHP/MySQL and ASP/Access. This book is required for all students in the program.
Dreamweaver MX 2004 with ASP, Coldfusion, and PHP - ISBN 0-321-24157-6 - Covers some basic Dreamweaver functions, but the reader should have some prior experience using Dreamweaver to fully comprehend the text. Students can learn the basics of three different scripting languages, PHP/MySQL, ASP/Access, and Coldfusion/Access, by completing this book. Elective course.
Sams Teach Yourself PHP, MySQL, and Apache - ISBN 0-672-32489-X - For students who would like to learn how to hand-code PHP/MySQL applications. Elective course.
Definition of Terms
PHP: Hypertext Preprocessor is a scripting language that is embedded in HTML. PHP scripting code is frequently used to connect web pages to MySQL databases to create dynamic web sites. Some popular examples of PHP driven web sites would be blogs, message boards, and Wikis. PHP files are actually plain text files; they can be created in TextPad or any other Plain Text Editor. In a text editor set the Save As type to text and save the file with a .php extension. Note: You must type the .php yourself. PHP files can also be created with Dreamweaver MX 2004. PHP is "open source" and therefore free. We use the Apache Server to work with PHP files in the classroom.
MySQL is a relational database system. MySQL uses
"Structured Query Language" which is the most common database language. It is the most popular "open source" database in the World. MySQL content can be managed via a command line or a web interface. MySQL is "open source" and therefore free. We use the Apache Server to work with MySQL files in the classroom.
Coldfusion is another scripting language used to connect to databases. It performs essentially the same functions as PHP, but it is produced by Macromedia. There is a free developer edition of Coldfusion available on Macromedia's web site. We use the Apache Server to work with Coldfusion files in the classroom.
phpMyAdmin is a popular PHP driven web interface that allows you to manage your MySQL database content via a web form. It is much easier to learn to use phpMyAdmin to manage your MySQL database content than it is to edit it from the command line. phpMyAdmin is "open source" and therefore free.
Apache is a popular web server that many ISP's and individuals use to host web pages. When you install Apache on your system your machine becomes a web server. Pages stored on your system in a "special folder" are accessible on the Internet via the machine's IP address. In order for pages to be viewed on the Internet, the files must be stored in a special directory; this directory is usually called
htdocs,
public_html, or
www. If you use a web host, you probably upload your files to a directory with one of these names. If someone else wants to access your web pages, they must know the IP Address of your machine, i.e., 179.199.9.100. Apache is "open source" and therefore free.
IIS or
Internet Information Server is Microsoft's web server. It performs the same functions as Apache and is used with ASP and Access files primarily, but it can also run PHP and MySQL. It can be installed on Windows based machines (Windows 2000, Windows XP, etc.). IIS is available on the Windows installation CD. Typically you will install Apache
or IIS; both servers services should not be running on your machine at the same time. IIS is needed to run ASP/Access applications.
Windows Services are used to run these servers and modules. Once services are installed they can be started and stopped via
Start >
Control Panel >
Administrative Tools (switch to
classic view if you do not see the Administrative tools) >
Services. These Services can be configured to automatically start or to be started manually. The Apache Service and the IIS service should not run at the same time. This will be discussed in more detail later in the tutorial.
PHP and Coldfusion Testing Requirements
In order to test PHP and Coldfusion pages you must have Apache, MySQL, and the PHP and/or Coldfusion module installed on your own computer or have a host that supports PHP or Coldfusion. You can use your f2o.org account, but it is much easier to test your PHP pages on your local machine. If you do not have these modules installed, you would have to upload your PHP pages to your ISP to view them. The beauty of Apache, MySQL, and PHP is that they're free. If you are working in the classroom and you are creating PHP web pages, you must start the Apache Web Server at the beginning of class each day.
WAMP5 Server Setup
Apache, MySQL and PHP are
already installed on our systems. We are using a free server bundle called WAMP5 for Windows which includes Apache, MySQL, PHP, and phpMyAdmin. It is very easy to install and it can be obtained from the
WAMPServer home page. While you can install Apache, MySQL, and PHP as separate modules, it is much easier to install the WAMPServer bundle. If you have never worked with server software than I would definitely recommend using the WAMP bundle. If you want to work at home, follow these steps to install WAMP5 on your home system.
Note: Please do not install WAMP on the classroom systems.
Installing WAMP5 Server
You can download a free copy of the WAMP5 Server from the
WAMP Server home page. Download the most recent version of the server into a folder on your hard drive. The file name will be similar to wamp5_1.43.exe. Locate the downloaded file and double click the file to launch the installation.
The WAMP5 Setup Wizard will appear. Click
Next.
The License Agreement screen will appear - Accept the agreement and click
Next.
At the Select Destination Location you can change the install directory. The default is C:\wamp. We use the default directory in the classroom. Click
Next.
Select the Start Menu Folder. We use the default WampServer folder in the classroom. Click
Next.
You can set WAMP to automatically start each time Windows start. I would recommend that you
do not check this option. This could cause security issues on your home computer if you were to leave the server running whenever the computer is turned on. You should manually start your WAMP/Apache server when you need it. Click
Next.
At the Ready to Install screen, click
Next.
The Installing screen will appear indicating the installation process.
You will need to select the default publishing folder or
DocumentRoot folder. This is the folder that you store your web site in. Any files that are placed in this folder will be available on the Internet by typing in the IP address of the machine. You will use this folder as the
Testing Server Folder when you are working in Dreamweaver. The path to the folder is C:\wamp\
www. Click
OK. On a web host you usually store your files in a folder called www or public_html; this procedure is setting up that storage folder.
At this screen you will
select your default web browser. In the classroom we have left Internet Explorer as the default browser. No changes were made to this screen. If you prefer to use another browser like Firefox or Opera you will have to navigate to the executable *.exe file of the browser. Click
Open.
If necessary, check Launch WAMP5 now and click
Finish to complete the Installation.
The installation is complete and the
WAMPServer will
Start.
This will launch Apache, PHP, and MySQL. A new icon will appear in the task bar
to the left of the clock. When you click the WAMP menu icon
a menu will appear. From the Wamp Menu you can start and stop the server (Start All Services or Stop All Services) on your machine and you can administer the MySQL databases with phpMyAdmin. This will be covered in greater detail later in the lesson.
To start the server at home, click
Start >
All Programs >
WampServer >
Start WampServer. Click the
WAMP5 Server icon in the task bar and select
Start All Services.
In the classroom you will need to click
Start >
All Programs >
Web Design >
WampServer >
Start WampServer to start Apache, PHP, Coldfusion. Click the
WAMP5 Server icon in the task bar and select
Start All Services.
Setting a MySQL Password
Note: We have already configured WAMP in our classroom, please do not change the passwords, users, or configuration files.
Once you get WAMP5 installed, you will want to change the MySQL password. When you first install WAMP5 passwords are not set. If you do not password protect your MySQL tables your are leaving your machine open to hackers. You can change the password by clicking the
WAMP5 Server icon in the task bar and selecting
phpMyAdmin. This will launch Internet Explorer and the phpMyAdmin web interface. Locate the Privileges link and change the
Privileges as directed in this
Password FAQ. You will want to be sure to change the 'root' password.
After you change the MySQL password you will
have to edit the
config.inc.php file typically located in
C:\wamp\www\phpmyadmin. Open this file with a text editor and scroll to approximately line
85. The code should look something like this:
You will need to type your new
password between the two single quotes as directed in the above image. Do not delete the quotes.
Setup PHP E-mail
Note: We have already configured WAMP in our classroom, please do not change the passwords, users, or configuration files.
The
php.ini file, located in
C:\wamp\apache, is used to configure the PHP module. A text editor can be used to edit the php.ini file.
In order to test mail functions on your PHP pages you will need to configure the mail function in the
php.ini file so that you can send e-mail. Click the
WAMP5 icon and select
Config Files >
php.ini. Look for the [mail function] section of the file located around line 594. You will need to know the
SMTP address (used to send e-mail) of your Internet Service Provider. This would be the same address that you use in Outlook or Outlook Express as your SMTP server. The SMTP address uses a format similar to this mail.yourwebhost.com, smtp.yourwebhost.com, or pop.yourwebhost.com. You will also need to type your e-mail address after the equal sign in the sendmail_from line.
[mail function]
; For Win32 only.
SMTP = mail.yourwebhost.com
; For Win32 only.
;
sendmail_from = youremailaddress@yourhost.com