# How To Install And Run WWWThreads

By Kevin J. Rice,
Kevin@justanyone.com or http://www.justanyone.com/

Directions are for Windows NT, Apache webserver, ActiveState Perl, MySQL, and WWWThreads Demo version (approx. 5.1.5).

I've taken great care to be COMPLETELY explicit about these directions.  There should be no areas that are ambiguous, fuzzy, etc.  If you find any, please email me and I'll see what I can do about clearing up the description there.

Note: The following directions are especially helpful if you’re installing WWWThreads on a Windows NT box that is either behind a nasty firewall or without a network connection. I had to create these directions because my client’s site (I’m a contractor) is behind a proxy server that demands a username and password and prohibits all FTP downloads. Obviously, this can be a barrier to many other people, too. The following directions apply to installing WWWThreads’ DEMO version. The full version has some additional configuration options I don’t include.

1. First, you need a webserver on your box. Download the Apache webserver from http://www.apache.org/. If you’re using IIS you’re on your own, but I suppose many of the configuration parameters are similar. Sorry I can’t help; I don’t have IIS.
2. Install Apache. It’s fairly straightforward and uses InstallShield, so this should be easy.
3. Go to Start --> Programs --> Apache Web Server --> Apache as a Service --> Install Service. This should make it run automatically. Check this by going to Start --> Settings --> Control Panel --> Services. Look for Apache. Highlight it. Click on ‘Startup’ button. Make sure ‘automatic’ is selected. Click okay and exit control panel.
4. Start a browser and go to the address, http://localhost/  You should see a message which says, "Apache installed correctly."; if it does, Apache is running ok. If not, and you’re using a proxy server, check your browser’s proxy settings to make sure localhost is on the proxy’s exclude list (in Internet explorer, Tools --> Internet Options --> Connections Tab --> Lan Settings --> Advanced --> Exceptions). If it’s not that, keep checking the Apache docs; I can’t help you much.
5. Recommended but not necessary: go to http://www.innerdive.com/ (note that's InnerDIVE not DRIVE) and download their monitoring program for Apache. It’s free, good, and useful.
6. Recommended but not necessary: Buy the O’Reilly text on Apache. Read at least the first 3 chapters. Find it at http://www.amazon.com/ or http://perl.oreilly.com/
7. Recommended but not necessary (though I presume you do it below): Modify Apache to work out of another data directory, one that doesn’t have a space in the directory name (spaces in filenames complicate your life – avoid them). The default installation directory for Apache files is "c:\Program Files\Apache Group\Apache", and spaces make this a pain in the butt. Try using a good directory name like, "c:\apachedir", "c:\webhome", "c:\wwwdir", etc. I’M USING c:\webhome USE WHAT YOU WANT. Decide on a directory name, and create that directory on your drive (in my case, "c:\webhome").
8. Next, edit Apache’s httpd.conf file ("c:\program files\apache group\apache\conf\httpd.conf"). Make the following changes:
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
# OLD: DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs"

DocumentRoot "C:/webhome/htdocs"

--> And, later in the file, this change, too… -->

# This should be changed to whatever you set DocumentRoot to.
# <Directory "C:/Program Files/Apache Group/Apache/htdocs">

<Directory "C:/webhome/htdocs">
9. After you make ANY change to httpd.conf (like the above one), you MUST restart the Apache server. Do this by Start--> Programs--> Apache as a service--> restart service. Give it 5 seconds.
10. Create the following subdirectories under c:\webhome: c:\webhome\htdocs, c:\webhome\cgi-bin. The c:\webhome\htdocs directory is where your site’s html files should go; cgi-bin is where all scripts will be presumed to be.
11. Use Frontpage, Dreamweaver, CuteHTML, or a text editor to create an HTML file. This is your site’s home page. If you use a text editor, don’t forget to start the file with the lines, "Content-type: text/html" then two blank lines and "<html><head>" etc. NAME THE FILE "index.html". Put it into a new directory, "c:\webhome\htdocs\". You can use any other directory name besides htdocs if you want, just make sure it’s correct in the httpd.conf file, the only place it’s referenced.
12. Test your relocated docs directory by browsing to http://localhost/and to http://localhost/index.htmland you’ll see the page you just created.
13. If you want, test your Apache setup further by modifying your c:\webhome\htdocs\index.html file and doing a browser refresh on localhost. You should see the update you made.
14. Okay, now you have a working Apache webserver installed. Now we need Perl.
15. Download ActiveState Perl 623 (or higher, whatever’s current). Install it – very easy, InstallShield makes this automatic.
16. Order a copy of the O’Reilly "Perl CD Bookshelf". It kicks ass. Find it at http://www.amazon.com/or http://perl.oreilly.com/
17. Test perl by creating a small hello.pl script containing this almost-legal html generation code:
	#!c:/perl/bin/perl
print "Content-type: text/html\n\n";
print "<html><h1>Hello, World! THIS IS PERL";

18. Create a directory "c:\webhome\cgi-bin\". Move/rename the file to c:\webhome\cgi-bin\hello.pl
19. Modify Apache to use c:\webhome\cgi-bin as your script directory. To do this, make the following changes as I have here:
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.

# ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"
ScriptAlias /cgi-bin/ "C:/webhome/cgi-bin/"

# "C:/Program Files/Apache Group/Apache/cgi-bin" should be changed to whatever your ScriptAlias
# CGI directory exists, if you have that configured.

# <Directory "C:/Program Files/Apache Group/Apache/cgi-bin">
<Directory "C:/webhome/cgi-bin/">
20. After you make ANY change to httpd.conf (like the above one), you MUST restart the Apache server. Do this by Start--> Programs--> Apache as a Service--> Restart Service. Give it 5 seconds.
21. Test your Apache setup with the Perl script by browsing to http://localhost/cgi-bin/helloworld.pl. You should see the "Hello World! THIS IS PERL" message.
22. If it doesn’t work, you probably forgot to make your top line is "#!c:/perl/bin/perl" and your second line is "print "Content-type: text/html\n\n";"
23. Now, we need the modules required to get WWWThreads running.
24. Note: My client has a particularly nasty firewall that prevents FTP and requires username/password proxy. Supposedly, ActiveState makes allowances for that and lets you set some environment vars so it can pass through. WRONG. I can’t get it to work. Alas. Regardless, it’s been a wonderful learning opportunity for me that I can share. Here goes.
25. Note: You need to use the ActiveState Perl Package Manager (ppm) program. If Perl is in your path (and it should be if you did the standard ActiveState installation), ppm is in your path.
26. Browse to http://www.activestate.com/PPMPackages/zips. I wanted the 6xx zips since I got ActiveState build 623. If versions are higher, adjust yourself. Click there and bring up the list of zips available.
31. If you don’t have Winzip, go to http://download.cnet.com/or http://www.davecentral.com/get it, and install it. If you hate it, feel free to use PKunzip from http://www.pkware.com/instead. Regardless, you need to unzip these files into their own directories just like winzip does.
32. Unzip the file abc.zip into directory abc\… etc., and extract each of the zips to its own folder.
34. Type, "ppm install Data-Dumper.ppd" at the command line. Output should indicate this works (no error messages).
35. Do likewise with Mysql.zip and DBI.zip
36. These 3 should complete without problems. I had a problem and reinstalling ActiveState fixed it.
37. NOTE: Data-ShowTable WONT WORK. This is a known issue – there is no Win32 distribution for it. Happy Days (NOT)! Okay, so here’s how to get around the problem:
39. I renamed the directory I unzipped Data-ShowTable.zip into "c:\dst\" - if you don’t, you need to translate the below directory paths.
40. Run the nmake.exe you downloaded in a temp directory. It will expand to 3 files, nmake.exe, nmake.err, and readme. Copy these to your c:\dst directory.
41. Run "perl makefile.pl" – this will create a file called ‘Makefile’.
42. Run "nmake" (no arguments necessary). It defaults to pick up the file ‘Makefile’. It creates a subdirectory tree blib with blib/arch, blib/lib, and blib/script.
43. Copy c:\Dst\blib\lib\data\ShowTable.pm c:\perl\lib\data\ShowTable.pm
44. Copy c:\Dst\blib\scripts\showtable. c:\perl\bin\showtable.
45. Copy c:\Dst\blib\scripts\showtable.bat c:\perl\bin\showtable.bat
46. Congratulations, you now have the Data-ShowTable module installed.
47. Next, we need to install MySQL.
49. Install MySQL by running what you downloaded. This should be fairly straightforward; I think it’s an InstallShield application as well.
50. So, we have Apache, Perl, the required Perl modules, MySQL, and a MySQL Admin tool installed correctly and running.
51. Next, a little diversion… You will probably want an administration tool for MySQL. There’s several I know of : WinMySQLAdmin (available at: ???? ), Mascon (available at http://www.scibit.com/), M2D (at http://dlabs.4t2.com/pro/m2d/m2d-info.html), and MySQL Front (at http://my.anse.de/). Pick one and install it so you know that your server is up and what databases/tables are on it. I’m using WinMySQLAdmin – I get a little traffic light that indicates if the MySQL service is running.
52. Create a database in MySQL named WWWThreads. To do this, cd to c:\mysql and type:
mysqladmin create WWWThreads
53. It should exit with good status (or at least not fail).
54. Next, we need to grant a user permission to use the database. This username is somewhat configurable; I had a little trouble with it because it thought my username was something different. So, you may have to mess around a bit with this.
55. In the c:\mysql directory, type "mysql" and you’ll get a prompt to enter further commands. Enter this (exactly):
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER
IDENTIFIED BY 'mysqlpass';
exit;

This gives the user wwwthreadsuser, password mysqlpass, proper permissions for database WWWThreads. Obviously, you can set the username and password to whatever you want, just remember them. If you want to change this, the only other place to change it is in the WWWThreads 'w3tvars.pm' config file (see below).

57. Unzip the wwwthreads software into a subdirectory (I presume it’s the directory named, "c:\temp\w3t". That creates a subdirectory of that called, "c:\temp\w3t\wwwthreads" that has about 10 directories and about 45 perl files plus the install directions, etc.
58. Do a copy / paste operation on these 10 directories and files to your cgi-bin directory (c:\webhome\cgi-bin\…). Now you have "c:\webhome\cgi-bin\addons\", c:\webhome\cgi-bin\admin\", etc.
59. Do a cut / paste operation to move the directory c:\webhome\cgi-bin\images\ to become c:\webhome\htdocs\images\"
60. Do a cut / paste operation to move the directory c:\webhome\cgi-bin\stylesheets\ to become c:\webhome\htdocs\stylesheets\"
61. Now you have a question to address: how do you want to do a global/search/replace on a bunch of files? I use the text editor, UltraEdit, a shareware program that’s a fantastic programmer’s editor (available at http://www.ultraedit.com)/. It includes the ability to do Search--> ReplaceInFiles-->
62. Search through all files (in all the subdirectories, too) in the c:\webhome\cgi-bin directory structure with a .pl extension and replace the first line of the file (which reads, "#!/usr/bin/perl") and replace the path to your Perl binaries (usually, "#!c:\perl\bin\perl"). This is vital and nothing will work until you do this. Note that this applies to all the .pl files in all subdirectories as well as just in the cgi-bin directory.
63. Do the same substitution for the correct perl path in the configuration files (*.pm in c:\webhome\cgi-bin\modules\*.pm).
64. Edit the main WWWThreads configuration file. This file is: c:\webhome\cgi-bin\modules\w3tvars.pm. Make the following changes (comment the old values out if you don’t have a backup of this handy). PLEASE NOTE: I’ve left out a bunch of directives that don’t impact getting up-and-running quickly. You may want to change these to customize your configuration. That said, the configuration is as following:
$config{'cgiurl'} = 'http://localhost/cgi-bin';$config{'images'}    = '/images';
$config{'path'} = 'c:\webhome\cgi-bin';$config{'styledir'}  = "/stylesheets";
$config{'dbserver'} = 'localhost';$config{'dbname'}    = 'WWWThreads';
$config{'dbdriver'} = 'mysql';$config{'dbuser'}    = 'wwwthreadsuser';
$config{'dbpass'} = 'mysqlpass';$config{'title'}     = 'WWWThreads Testing Installation';
$config{'homeurl'} = 'http://localhost';$config{'urltitle'}  = 'Localhost_link';
$config{'emailaddy'} = 'Yourname@yourdomain.com’; NOTE: is the directory named "image" or "images" ? Make sure it’s the same in both places… 65. Once you’ve edited this and saved it, we’re ready to create the WWWThreads database. Luckily, there’s a script to do this for us. 66. Cd to c:\webhome\cgi-bin directory. Run the WWWThreads createtable perl script to create necessary tables in MySQL. Here’s a sample of the output: C:\ webhome\cgi-bin>createtable.pl Content-type: text/html System Error: DBI->connect(WWWThreads:localhost) failed: Access denied for user: 'nobody@localhost@localhost' (Using password: YES) at modules/w3t.pm line 487 DBI->connect(WWWThreads:localhost) failed: Access denied for user: 'nobody@local host@localhost' (Using password: YES) at modules/w3t.pm line 487 OOOPs, must have misconfigured the username and password. Yes, I did this on purpose to show you the message. To fix this, go to c:\mysql, run mysql, drop the table wwwthreads, create the table again, and (with a doublecheck of your typing and upper/lowercase setting) the username password for the GRANT command above. Then, re-edit your w3tvars.pm file and enter the username and password, exactly as you did in MySQL’s Grant command, under dbuser and dbpass. Okay, trying it again: C:\webhome\cgi-bin>createtable.pl Creating the tables... Board table created... Posts table created... Adding a master poll table... Adding the poll results table... Last viewed table created... Category table created... Users table created... Moderator table created... Messages table created... Banned table created... Groups table createdBasic groups created... Online table created... Subscribe table created... Creating table for the address book... All tables created. Remember, this is a feature limited demo of the full WWWThreads package. Many options are not available or turned off in this version. If you really want to give your visitors a true forum package purchase the full version at http://www.wwwthreads.com/purchase.html. Thanks, Scream (Rick Baker scream@wwwthreads.com) 67. OKAY! THINGS SHOULD BE SET UP. Test your installation by opening a browser window and going to http://localhost/cgi-bin/wwwthreadsand if it comes up, you win! 68. Check your Stylesheets! On the main page, you should have lines around the different sections. If you don’t, it’s probably your stylesheet settings. Make sure you moved the stylesheets directory to under htdocs (just like the images subdirectory, as directed above, and that this directory is specified correctly in the w3tvars.pm file). 69. Check your images! Go to the FAQ (http://localhost/cgi-bin/faq_english.pl?Cat=) and about halfway down the page should be images of a smiley face, etc., make sure you have relocated the images subdirectory as noted above. 70. If you have problems, it could also be your my.ini file - make sure the user and password don’t conflict with the one you just set up. 71. Suggestion: Check that mysql service is started. Do this via: Start--> Settings--> Control Panel--> Services--> mysql. It should show ‘started’ and ‘automatic’. If it’s not started, start it, if it’s not automatic, make it automatic. 72. Browse to the admin screen and try to log in. If you can’t, here’s what you do: 73. Go to c:\mysql\bin and type ‘mysql’. Then type: "mysql> select U_username, U_password from w3t_users;" 74. You will see the output of something like: mysql> select U_username, U_password from w3t_users; +------------+---------------+ | U_username | U_password | +------------+---------------+ | Kevin | RdmziFgbzf0vw | | MainAdmin | Pwt7eQrknt4Pw | +------------+---------------+ 2 rows in set (0.00 sec) 75. (or possibly just the first one). You need to use the admin login of MainAdmin (your 0th user) and the password given. Yes, it’s encrypted. No, you can’t go backwards to find your original one. Oh well. At least you can log in as administrator now. 76. OPTIONAL SECTION: YOU NEED AN SMTP MAIL ACCOUNT; IF YOU DON'T HAVE ONE, THIS NEXT PART TELLS YOU HOW TO GET ONE ON YOUR OWN BOX. TO SKIP THIS SECTION, LOOK BELOW FOR 'END OF OPTIONAL SECTION'. Next, you need to configure the email setup. I had a load of fun with this one (NOT). Because I'm doing this for a company, I’m on a Microsoft Exchange server setup, and can’t use the email SMTP provided by it for some (mystical) reason. So, I downloaded an SMTP/POP email server from the net and installed it on this box. Since this involved new software, I had some fun learning it for a morning. But, here goes. 77. Go to download.com or tucows.com, etc. and download the program, "VPOP3" and install it. Pretty simple until you answer questions you’ve never heard of before. Here’s the setup that I did: 78. When it asks if it should be an NT service, say yes. 79. When it asks in the setup wizard for inbound and outbound smtp users, I just hit next and ignored it. 80. I think I had to click on the icon on the NT taskbar that is the up-arrow and do ‘settings’. 81. I got to the setup screen, it had ‘users’ listed. Add two or three for yourself. Remember the passwords – write ‘em down. Stuff like, My.name and someone.here etc. 82. Leave the ‘mappings’ tab blank. 83. Leave the ‘Lists’ tab blank. 84. Click on the Local Mail tab. Good Luck! You can’t get out now unless you do it right. Here’s how: set default domain to be something like joeblow.net and check the ‘route mail locally’ box. Under ‘local mail domains, put the same thing, joeblow.net. Uncheck the send local mail to isp box if it is checked. 85. Under ‘In Mail’ tab, click add in-mail setting. Invent a name, ‘kevinISP’ or something. Use VPOP3 file xfer. Jump to windows explorer and create 2 directories under c:\temp of c:\temp\vpop\in and c:\temp\vpop\out. Put c:\temp\vpop\in in the source path box. Click all the users that come up. 86. Under ‘out mail’ tab, click ‘vpop3 file xfer’ and put c:\temp\vpop\out in the path. 87. Click the ‘admin’ tab and check the ‘automatic login password’. Put in the password for postmaster, which is ‘admin’. 88. Go to ‘local Servers’ tab and click configure on the pop3 line. Uncheck ‘require apop authentication’. Click ok. 89. Click configure on the smtp server line. Uncheck ‘require smtp authentication’. Uncheck ‘require pop3 then smtp authentication’. Leave the rest unchecked as well (the ‘do not require’ should be greyed out, regardless of it being checked). 90. Notice that there’s a web admin server at port 5106, 5107, and 5108, you’ll use this below. 91. Close the VPOP3 settings. 92. Web browse to http://localhost:5108/and you can see your mail. Remember the username and password for that user. 93. Send mail from one user account to another one. Remember which one you sent. On another browser window, open up another session and log in for that user; you should see mail for that user. Make sure to make your test messages unique so you know where each was coming from, etc. 94. Go to MS Outlook express or another email client and click tools--> add account. Set it up for an smtp connection of incoming Pop3 server: localhost, outbound smtp server: localhost, username=one of the ones you created, password=that user’s password. 95. Click send receive mail. You should have mail and be able to send and receive on both accounts if you want. 96. You can also set up outlook express for multiple user profiles – change user etc., and have an account for each user. Whatever. 97. Great! Now you have an SMTP email server on your desk! 98. END OF OPTIONAL SECTION. 99. Next, you need to configure WWWThreads to use that mail server. Edit the c:\webhome\cgi-bin\wwwthreads\modules\w3tvars.pm file. Change the line to be:$config{'SMTP'} = '127.0.0.1';

where, if you have an SMTP mail account elsewhere besides the VPOP3 one we just set up, put the address instead of 127.0.0.1.

100. Go into wwwthreads and send a private message to one of your users. If you don’t have any users, log in as if you were someone else, create a new user with the email address of mailto:my.name@joeblow.net(see above to see where I got this name from). It doesn’t matter that there might be an actual http://www.joeblow.net/. You don’t care.
101. The wwwthreads send message routine should indicate no errors.
102. Go to outlook express and hit send/receive. A mail message should appear that you have a private message waiting at the web address (etc.).
103. Now, it send mail!
104. Next, add a forum or two and a couple of messages.
105. Don’t forget your status as system god. You need a picture of yourself, not too shabby, in the format of 75 pixels tall x 65 pixels wide. Put it at a known location (specify it as http://localhost/mypic.jpgand then put it in c:\webhome\htdocs\mypic.jpg and it should show up next to your name.
DONE! All you need to do now is configure WWWThreads to your taste!