Apache HTTP Server with MySQL Database

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

Test Apache using: http://localhost:8080

Directory Setup

I used the folowing directory structure for the web source. htdocs contains the html files, and cgi-bin contains the perl .cgi files.

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.

Example Source

This example shows:
SearchForm.html
MyList.cgi
Mylib.pm

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.
Hosted by www.Geocities.ws

1