Setting up MySQL and Perl on a Windows based server.


This document is intended to be a general help file for installing the prerequisite 3rd party software required to run Webdata.
Webteacher Software does not support the MySQL or Perl installer programs.
If you have any difficulty with the installation of MySQL or Perl, please consult the
resources indicated on the product home pages.

There are 3 things which a Windows machine must have in order to run Webdata Pro.

   1.A web server
   2.ActivePerl (with MySQL modules)
   3.MySQL

1. The web server.

If you are attempting to install Webdata Pro on your Windows machine, it is likely that you have already enabled the IIS services to make Windows perform as a web server. The IIS server (known in Windows 98 as "Personal Web Server") is available, to the best of my knowledge, on all versions of Windows since '95 with the exception of Windows XP non-professional. See your online help under "IIS" or "Personal Web Server" for instructions. If you are using Windows XP non-professional, there are several 3rd party web servers that you can install, including Apache (http://www.apache.org).

Before proceeding to step 2, you should be able to put a test HTML page (yourpage.html) into your web server's root directory and browse to it by typing http://localhost/yourpage.html into Netscape, Firefox or Internet Explorer.
 

2. ActivePerl

Download ActivePerl from http://www.activestate.com.
At the time of this document, the download page was at http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl

If you are running Windows 95, 98, or Me, you will need the Windows Installer 2.0. A link is provided.
More current versions of Windows come with Windows Installer automatically, so you can just grab the, "Windows MSI" link.
Install using the default options. It should enable IIS functionality by default.
 

Create and test a cgi-bin

Open the control panel for IIS or Personal Web server
If there is not already a directory named "cgi-bin" under your web server's root directory, create one.
Make sure that the directory alias is:   cgi-bin.
Make sure that "Execute (including scripts)" is enabled for "cgi-bin". Stop and restart the web server.
Copy the following into a file named "test.pl" and place it into the cgi-bin:

         print "Content-type: text/html\n\nHello World!";

Now point your web browser to http://localhost/cgi-bin/test.pl. You should see "Hello World!" appear on your screen. If it doesn't, restart your computer and try again. If you still have problems, see Appendix A.

Before proceeding to step 3, you should be able to get "Hello World" to appear when browsing to "test.pl".

3. MySQL

Download MySQL from http://www.mysql.com. Just click "Downloads" then choose the latest stable release, scroll down to the "Windows Downloads" section and click "Download". Extract and install the download file using all default options.

To test the installation, click the Start button, choose "Run" and enter this into the box.

c:\mysql\bin\mysql
You should get a DOS window with this:

         Welcome to the MySQL monitor. Commands end with ; or \g.
         Your MySQL connection id is 3 to server version: 3.23.25-beta
         Type 'help;' or '\h' for help. Type '\c' to clear the buffer
         mysql>

Type "quit" and hit the Enter key to exit.

Before proceeding to step 4 you should be able to bring up the MySQL monitor. If you have problems, see Appendix B.
 

4. The DBI and DBD Perl modules

ActivePerl comes with a great tool for installing Perl modules. The program will download, extract, and install the modules for you with a single command. Just open a DOS window and type these commands:

         ppm
         install DBI
           (type "y" to confirm)
         install DBD-mysql
           (type "y" to confirm)
        (and if you will need to make thumbnail images)
         install Image-Magick
           (type "y" to confirm)
         exit
 

These usually install without a hitch. You can test it by entering the following command into a DOS window:

         perl -e "use DBI;use DBD::mysql"

If the modules are installed correctly, you should not get any error message, just a new command prompt.

If you do have problems, consult the documentation or support options on the ActiveWare web page.

Before proceeding to step 5 you should have installed the DBI and DBD-mysql modules correctly.

5. Create passwords for MySQL

When you first install MySQL, it does not have any accounts and there is no root password. We need to fix this to make your server more secure.
Choose values for the following:

A MySQL root password (rootpass) __________________
A name for your Webdata Pro database (dbname) ________________
A username for a MySQL account to access your Webdata Pro database (dbusername)_____________
A password for dbusername (dbpassword) _____________________
A password to enter into Webdata Pro when logging in as admin (adminpass) ____________________
 

In the following instructions, replace all occurrences of the words in parentheses above with the value you chose next to that word.

In a DOS window, enter the following commands:

cd c:\mysql\bin

mysqladmin -u root password rootpass

mysql mysql -u root -p
  (enter rootpass at the prompt)

You should now have a mysql> prompt.
CREATE DATABASE dbname;

INSERT INTO user VALUES ('localhost','dbusername',password('dbpassword'),'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N');

INSERT INTO db VALUES ('localhost','dbname','dbusername', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');

FLUSH PRIVILEGES;

QUIT

And finally, to test your new account and password...

mysql dbname -u dbusername -p
Enter your password at the prompt. If you get "Welcome to the MySQL monitor..." then everything worked, type "quit" to exit. If you get an "Access Denied" error, you need to log in as root (start at line 3 above) and try again.

At the time this document was written, the current release of MySQL had 14 fields in the user table which could be set to 'Y' or 'N', and 10 fields in the db table with the same options. If
you get a "column count does not match field count" error, type DESCRIBE user; or DESCRIBE db; for the first or second INSERT command respectively and count the fields, then
compare the field count to your own statement.

Before proceeding to step 6 you should have created and tested your MySQL database, user, and password.

6. Install the software

See the "readme.html" which comes with Webdata Pro. You are almost there.
 

APPENDIX A - Problems running Perl CGI scripts.

If you see the source perl code instead of just the words "Hello World!"
then the Perl installer did not properly modify IIS for Perl.

The steps below will configure the Microsoft Personal Web
Server and IIS to run Perl5.

1.Click on Start, Run, regedit.exe
2.Expand HKEY_LOCAL_MACHINE
3.Expand System
4.Expand CurrentControlSet
5.Expand Services
6.Expand W3Svc
7.Expand Parameters
8.Expand Script Map
9.Right click within the right pane/frame (of Script Map) and select New, string value.
10.Enter .pl
11.Modify .pl and enter the full path to the perl.exe program along with "%s %s"
example: e:\Perl5\bin\perl.exe %s %s

11.Create additional entries for ".cgi" and ".plx"
12.Exit Regedit.
13.If MS PWS is running then, then start and stop http services.
 
 
 

APPENDIX B - Problems running MySQL.

1. Restart your machine and try running MySQL again.
2. In the C:\mysql directory, double-click "mysqld-opt". A DOS window should appear for a few moments and then dissapear.
3. In the c:\mysql directory, doubld-click "winMySQLadmin". A GUI window should open. The traffic light symbol should be green. If there is a button labeled "START Extended Server Status", rather than "STOP Extended Server Status", click it. Then click "hide me".
4. If you still cannot get MySQL to come up, consult the MySQL help file.