« Frozen Dead Guy Days in Nederland | Main | Apache Error Messages »
March 10, 2006
Installing Apache on XP
OK. I'm sick of IIS. IIS sucks so hard. Could suck chrome off a trailer ball. Suck a golf ball through a garden hose. And I, for one, am through with it. So, I'm installing Apache under XP. OK. Maybe I should be running Linux. We'll deal with that later. I don't feel like changing the OS unless I asbolutely have to. So I'm going to try running Apache under XP. It can't be any worse than IIS. That much is certain.
I found a website dated 29 February 2004 that has directions on Installing Apache on XP (Apache version 2.0.48). But, this information is about two years old.
So, I went to the Apache Website and downloaded the latest version from a mirror.
The first thing I notice is that, these open source geniuses are reaaaallly bitheads. There's nothing user friendly about Apache. H3ll, you can't even find it. For instance, from the main mirror site, there are dozens of folders. You have to guess that the one for Apache is named "httpd". I'm not making this up. So, I'm looking at the folder http://apache.mirrors.pair.com/httpd/. It appearst that the current version is 2.0.55. There's lots of .tar files, which is like WinZip for Unix I think. Then I found this zip file, which I'm guessing is the one that I want:
http://apache.mirrors.pair.com/httpd/httpd-2.0.55-win32-src.zip
Then, I noticed that the directions on the web page recommended I get the .MSI package:
http://apache.mirrors.pair.com/httpd/binaries/win32/apache_2.0.55-win32-x86-no_ssl.msi
So, I downloaded the msi file and saved it as c:\apache\apache_2.0.55-win32-x86-no_ssl.msi.
I launched the .msi file and got "Welcome to the Installation Wizard for Apache HTTP Server 2.0.55". I clicked Next and accepted the license agreement. Now, it's prompting me for the following:
Network Domain
Server Name
Administrator's Email Address
I'm not real sure what to put here, so I checked Installing Apache for Windows. I googled tfor this, but everything I saw said it didn't matter, so eventually, I just put this:
Network Domain peeniewallie.com
Server Name www.peeniewallie.com
Administrator's Email Address peeniewallie@wispertel.net
Then, I selected a "typical" installation, let the install location default, and clicked Install to begin the installation and it started installing. But, I then I got an error message. It said it installed successfully, but I doubt that it did.
So, I tried running the .msi file again, and it gave me the option of removing it or repairing it. So, I opted for "repair". It gave me the same error message.
(OS 10048)Only one usage of each socket address (protocol/network address/port)
is normally permitted. : make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Note the errors or messages above, and press the
[Fri Mar 10 14:46:04 2006] [error] (OS 2)The system cannot find the file specifi
ed. : No installed service named "Apache2".
Note the errors or messages above, and press the
Apache monitor is already started.
Then, it says "The Installation Wizard has successfulling installed Apache HTTP Server 2.0.55." Yeahhhh....I'm going to have to go ahead and disagree with you on that..."
So, I'm guessing that it's because I have IIS running on Port 80 right now. Not 100% sure. Just a guess. This site seems to agree with my guess. Need to uninstall IIS.
But, before I blow away IIS, I want to make sure I can get Apache running, so I want to try to get it running on a different port. However, when I do the repair, I don't get that option. So, I'll remove Apache and reinstall it on a different port.
So, I removed it and resintalled it. This time, I selected "only for the Current User, on Port 8080, when started Manually". Selected "Typical" installation. Let it default to C:\Program Files\Apache Group\. Clicked "Install" to begin the installation.
This seems to have worked. I get the "Apache Monitor is already started", which is somewhat concerning since I had just uninstalled the product, but hey, it's free, right? Then, it says "The Installation Wizard has successfulling installed Apache HTTP Server 2.0.55."
So, other than the stalwart Apache Monitor, I got no errors or warnings, which leads me to believe Apache is up and running on port 8080.
However, I looked in my taskbar in the lower right corner, and I see a little feather, but it has a red dot in the center instead of a green triangle. When I hover over it, it says "No services installed", which isn't really what I'd hoped for.
So, I closed and restarted the Apache Monitor, but still the same thing. "No services installed". Hmmm.
I tried starting the Apache server, but it gave me that odd bind message again:
(OS 10048)Only one usage of each socket address (protocol/network address/port)
is normally permitted. : make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Note the errors or messages above, and press the
So, I decided to just Stop the web service in IIS, and see if I could start Apache that way. Now, I get a new error message:
Windows Security Alert: To help protect your computer, Windows Firewall has blocked some features of this program. Do you want to keep blocking this program?
Name: Apache HTTP Server
So, I clicked on Unblock.
Then, I see a little DOS windows that says "Start Apache in Console".
I went to this url http://127.0.0.1/ and saw that apache is running.
If you can see this, it means that the installation of the Apache web server software on this system was successful. You may now add content to this directory and replace this page.
But, my little monitor is still showing the red dot. I can't see my site from other sites, only locally. So, I think it's working, but only on port 8080
locally for me. I want to do the full-on correct install on port 80, so I stopped the apache service monitor,
uninstalled it and reinstalled it again.
This time, it worked like a champ. I have my little green triangle in my apache service monitor. I see the service
named Apache2 in the monitor. I'm happy.
Now, I can see the Apache web server intro page from remote computers as well. So, Apache is up and running.
Now, must point apache to my web pages.
Clicking on the Start button of your taskbar and selecting "All programs" you will see the "Apache HTTP Server 2.0.48"
entry. Click it. Click on Configure and click on Edit the Apache httpd.conf file. Search for the DocumentRoot
entry and this will tell you where you need to place the files to be served via your brand new Apache web server.
DocumentRoot "C:\Inetpub\wwwroot"
stop/start service.
Now, I can see my web pages, but my Perl scripts don't appear to be working. Doh!
http://www.cgi101.com/book/connect/winxp.html#6
so apparently, I need to enable my .cgi scripts:
Scroll down just past that and you'll come to a commented section for Directory:
#
# AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
#
# Order allow,deny
# Allow from all
#
#
# Order deny,allow
# Deny from all
#
#
Uncomment this entire section (by removing the pound signs at the beginning of each line), and change the Options line to this:
Options MultiViews Indexes SymLinksIfOwnerMatch Includes ExecCGI
Options specifies what options are available in this directory. The important ones here are Indexes, which enables server-side includes, and ExecCGI, which enables CGI programs in this directory.
Scroll down a bit further to the DirectoryIndex line, and add index.cgi to the end of that line:
DirectoryIndex index.html index.html.var index.cgi
Now scroll down several pages (or use Find) to the AddHandler section. Uncomment the CGI line:
AddHandler cgi-script .cgi
This causes any file with a .cgi extension to be processed as a CGI program. If you want to also have files with a .pl extension be processed as CGI programs, add the .pl extension on that same line:
AddHandler cgi-script .cgi .pl
Next add this line immediately after:
AddHandler server-parsed .html
This causes all .html files to be searched for server-side include tags.
Now save the configuration file, and restart Apache. Check http://localhost/ in your browser to ensure that the server restarted successfully.
See the following Microsoft document on How to Remove IIS.
http://support.microsoft.com/default.aspx?scid=kb;en-us;321141
So, I restarted the Apache server by clicking on the Apache Monitor and selecting "Restart".
But, when I try to run Movable Type, I get this:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
And now I'm getting Forbidden when my random quote .pl script tries to run.
So, I created and executed this cgi:
#!/perl/bin/perl -wT
print "Content-type: text/html\n\n";
print "
Hello, World!
\n";http://www.peeniewallie.com/mt/hello.cgi
And, it says "Hello world".
Configuring Apache to permit cgi
http://httpd.apache.org/docs/1.3/howto/cgi.html#configuringapachetopermitcgi
http://httpd.apache.org/docs/1.3/howto/cgi.html#butitsstillnotworking
A message starting with "Forbidden"
That means that there is a permissions problem. Check the Apache error log and the section below on file permissions.
A message saying "Internal Server Error"
If you check the Apache error log, you will probably find that it says "Premature end of script headers", possibly along with an error message generated by your CGI program. In this case, you will want to check each of the below sections to see what might be preventing your CGI program from emitting the proper HTTP headers.
So, I want to check my error logs, but where are they?
C:\Program Files\Apache Group\Apache2\logs\error.log
[Fri Mar 10 17:15:52 2006] [error] [client 192.168.1.1] (OS 3)The system cannot find the path specified. : couldn't create child process: 720003: mt.cgi
[Fri Mar 10 17:15:52 2006] [error] [client 192.168.1.1] (OS 3)The system cannot find the path specified. : couldn't spawn child process: C:/Inetpub/wwwroot/mt/mt.cgi
[Fri Mar 10 17:17:53 2006] [error] [client 72.30.110.30] File does not exist: C:/Inetpub/wwwroot/robots.txt
[Fri Mar 10 17:19:58 2006] [error] [client 66.218.65.27] File does not exist: C:/Inetpub/wwwroot/robots.txt
[Fri Mar 10 17:22:18 2006] [error] [client 192.12.240.129] C:/Inetpub/wwwroot/scripts/quote.pl is not executable; ensure interpreted scripts have "#!" first line, referer: http://www.peeniewallie.com/
[Fri Mar 10 17:22:18 2006] [error] [client 192.12.240.129] (9)Bad file descriptor: don't know how to spawn child process: C:/Inetpub/wwwroot/scripts/quote.pl, referer: http://www.peeniewallie.com/
So, I couldn't figure out why my movable type kept getting internal server error. I checked the log, and it said
"The system cannot find the path specified."
But, my Hello.cgi worked fine, so I copied the top line from that one into my mt.cgi script.
I replaced this:
#!/usr/bin/perl -w
with
#!/perl/bin/perl -wT
Then I got this error:
Got an error: Insecure dependency in require while running with -T switch at lib/MT.pm line 220.
So I'm dropping the T.
This fixed it. Now, it's working. Top line of the .cgi scripts has to be like this:
#!/perl/bin/perl -w
However, this is not the ideal solution. Somehow, we need to tell Apache where perl is. Then, I think it
could ignore this top line. IIS must have known where perl was, as it didn't use the header row.
http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/faq/Windows/ActivePerl-Winfaq6.html#configure_Apache20x
Ensure that you use forward slashes (/) in the path, as Apache doesn't understand backward slashes (\) in paths. For example:
In DOS, I checked my path:
C:\>path
PATH=C:\Program Files\Windows Resource Kits\Tools\;C:\Perl\bin\;C:\WINDOWS\syste
m32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Sonic\MyDVD;C:\MySQL\bi
n;C:\Program Files\NVIDIA Corporation\Cg\bin;C:\Program Files\SSH Communications
Security\SSH Secure Shell
I can't find anywhere that you say "perl is here...use it", so I'm going to try reinstalling active perl.
http://activestate.com/store/languages/register.plex?id=ActivePerl
The old version of Active Perl I had installed was 5.8.6. So, I'll create a new folder named Perl587
with version 5.8.7.815.
http://activestate.com/Products/Download/Download.plex?id=ActivePerl
Don't register. Just click next.
Get the MSI version for windows:
http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.7.815-MSWin32-x86-211909.msi
So, I launched the MSI file, click next, accept license, changed install folder to c:\Perl587,
next, next, Finish.
There's no connection that I can find anywhere, that tells Apache where the Perl.exe file is. So,
I figured I'd move the Perl folders to the c:\usr\bin and see if it found them there. It did, but the
it was griping about some mysql.pm file.
Got an error: Unsupported driver MT::ObjectDriver::DBI::mysql: Can't locate DBI.pm in @INC (@INC contains: C:\Inetpub\wwwroot\mt\extlib lib C:/usr/lib C:/usr/site/lib .) at lib/MT/ObjectDriver/DBI.pm line 10.
BEGIN failed--compilation aborted at lib/MT/ObjectDriver/DBI.pm line 10.
Compilation failed in require at lib/MT/ObjectDriver/DBI/mysql.pm line 10.
BEGIN failed--compilation aborted at lib/MT/ObjectDriver/DBI/mysql.pm line 10.
Compilation failed in require at (eval 6) line 1.
BEGIN failed--compilation aborted at (eval 6) line 1.
So, I was like ...great. So I deleted the perl587 libraries
and copied the perl 586 libraries to c:\usr\bin.
I restarted the apache server.
And that worked. So, basically, I copied my existing Perl libraries to the c:\usr\bin folder structure, and now the
MT scripts are finding Perl and they're happy. This means I don't have to modify all of my MT Perl scripts. :)
Now, I'm still getting this Internal Server error running my quote.pl script. Hmmm.
[Fri Mar 10 17:22:18 2006] [error] [client 192.12.240.129] C:/Inetpub/wwwroot/scripts/quote.pl is not executable; ensure interpreted scripts have "#!" first line, referer: http://www.peeniewallie.com/
[Fri Mar 10 17:22:18 2006] [error] [client 192.12.240.129] (9)Bad file descriptor: don't know how to spawn child process: C:/Inetpub/wwwroot/scripts/quote.pl, referer: http://www.peeniewallie.com/
Added this line to the top of my perl script.
#!/perl/bin/perl -w
Now, It's working. :)
Posted by Peenie Wallie on March 10, 2006 at 1:02 PM