My goals were to have a web server with a lot of functionality
(database, scripts, etc.) and using little disk space on NT.
The reasons for this is that I wanted to use this system for
testing, and then install to a real web server.
I originally tried to use
Tomcat without the Apache web server just for testing, but kept
getting:
"Can't create TCP/IP socket". (10106) WSAEPROVIDERFAILEDINIT.
So I quit using the Tomcat server and only used the Apache
web server without Tomcat. Everything worked then, although
I cannot use Java servlets.
Since my web server hosting service allowed perl and
mysql, and no Java, the Apache solution was fine for the
current project.
Setting up software
Download mysql. I used 4.0.18.
Download mysqlcc. I used 0.9.4.
Download Apache hhtp server or Apache with perl. I used 2.0.48.
Download indigo perl, activestate perl or mod_perl.
I used perl-win32-bin.exe. Install to root. If it makes
a perl directory from the root, rename the perl
directory to usr. This allows the "#!/usr/bin/perl -w"
line in the script files to work on NT and Unix.
For some of these, you may need to
run ppm and enter "install DBI". Then
"install DBD::my_sql".
I used the folowing directory structure for the
web source. htdocs contains the html files, and
cgi-bin contains the perl .cgi files.
Web
cgi-bin
htdocs
Deployment
Make a deploylocal.bat file with the following:
del /q /s \apache2\htdocs\
del /q /s \apache2\cgi-bin\
xcopy /s ..\web \apache2\
The remote deployment will depend on your web host
service and may use ftp. The permissions for cgi files
must be set to allow execution. Using the ftp that comes
with Windows, something like the following can be used.
echo myusername>tempftp.txt
echo mypassword>>tempftp.txt
echo bin>>tempftp.txt
echo cd myhtmldir>>tempftp.txt
echo put ../web/cgi-bin/searchForm.htm>>tempftp.txt
echo cd mycgidir>>tempftp.txt
echo put ../web/cgi-bin/myList.cgi>>tempftp.txt
echo quote site chmod 700 myList.cgi>>tempftp.txt
echo put ../web/cgi-bin/myLib.pm>>tempftp.txt
echo quote site chmod 700 myLib.pm>>tempftp.txt
ftp -s:tempftp.txt mywebsite.com
del tempftp.txt
Errors
Compilation errors will show up in the logs/error.log
file of Apache. Simply deploy the code, and then if
the url is still the same, execute it by refreshing
the browser. There is no need to reload the Apache web
server in almost all cases.
The SearchForm.html should be in the htdocs directory.
When it is run from
http://localhost:8080/SearchForm.html
and the Apache server and MySQL database are running, the
HTML page should display. When the OK button is
pressed, the input box is read, and transferred to
the cgi/perl script MyList.cgi. This perl script
will use functions in the Mylib.pm file to display
an error and access the database. Both the Mylib.pm and
any cgi files should be in the cgi-bin directory.