Follow us on Twitter
Joomla Components

Video Games School German Golf shop Find freeware at AC's Freeware Site seo techieBeautiful dresses at dressale.comCool Electronics Gadgets from China

Latest in Blog

Web Server @ Home - Installing Apache2 PDF Print E-mail
Web Server @ Home is where this series commenced. This is follow up to that discussion. Please read it if you want to know motivation behind this discussion.

Apache2 is the one of the best Web Server out there. And it is free too!! According to Apache Official Site (http://www.apache.org),

The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.

Apache has been the most popular web server on the Internet since April 1996. The November 2005 Netcraft Web Server Survey found that more than 70% of the web sites on the Internet are using Apache, thus making it more widely used than all other web servers combined.

The Apache HTTP Server is a project of the Apache Software Foundation.

Followings are detailed information on how to install Apache2 over cygwin/Windows XP.

Please note that do not install Apache using cygwin setup, because we want to build Apache for Windows Native Machine because of performance reasons. Assumed is that all the steps for cygwin installations are followed as outlined in  Web Server @ Home - Installing cygwin.

Apache2 Installation on cygwin/Windows XP

  • Install cygwin as outlined in Web Server @ Home - Installing cygwin.
  • Download Apache Source Code. Please do not download from official Apache, instead use cgywin setup program to download. Patch is required to build Apache2 on cygwin and that is available via cygwin setup program. For this
  • Open cygwin setup.. This is setup.exe which was downloaded first before even cygwain was installed
  • Go through all the step till you reach package selection window. Click on view button until your see full or click on web catagory.
  • Select Apache 2. Unselect binary and select Source  option.
  • Downloaded Apache 2 Source is unpacked into /usr/src directory. Please verify all the packages (as outlined before) are installed including patch & libtools1.5.
  • Go to /usr/src directory. Execute 'cd /usr/src' for this (You probably know it because only UNIX/Linux freaks are going to do work with cygwin :)
  • Apply patch by running following command
run apache.xxx.sh prep
  •  apache.xxx.sh provides many options but please do not be tempted and do as exactly told.
  • cd httpd-xxxx directory and run following configuration script
configure --enable-so --enable-rule=CYGWIN_WINSOCK  --enable-rule=SHARED_CORE --enable-module=all --enable-mods-shared=most
  • Above configuration scripts configures to generate shared loadable modules and uses Native Windows Socket for Apache Specific System Calls. Because  of Shared Modules Option, Apache server will use only required amount of memory (Significant, considering if few modules are used and Apache spawns multiple processes) but performance hit will be of 5% & initial load time will be little higher.
  • Native Windows Socket use improves performance by 30%. Big huh!! That's why we wanted to build it by ourselves.
  • Run
make; make install
  • Files will be installed in /usr/local/apache2, See if all directories & modules are properly installed including lib etc. Look for httpd.exe, apachectl, aspx in /usr/local/apache2/bin
  • Check for httpd.conf file in /usr/local/apache2/conf
  • See if all files in bin directories are executables and have appropriate permissions, if not, change mode using chmod
  • Go to /usr/local/apache2/conf directory & create a directory called conf.d if it doesn't exists.
  • Edit conf file for user name and password
  • Remove any unnecessary module from httpd.conf (Look for AddModules and comment out not required ones)
  • Go to /usr/local/apache2/bin, edit apachectl and replace httpd2 with httpd
  • Run following command and look for basic errors. Correct if you can otherwise you can ask me.
apachectl -t
  • If everything is okay, run "apachectl -k start", it will start Apache server. Look for host information/IP information which is printed by this command.
"apachectl -k start",
  • Open a browser, type in IP address (host name) of your machine, it should be working now.
Apache installation is finished..

Next: Installing MYSQL.. Stay tuned...

Comments
Installing on Win 2000
SVTechie 2006-04-06 08:46:03

Name Withheld (name@witheld.com) wrote:

Hello,
First, i want to thank you for the wonderfull guidelines your wrote for
installing cygwin. There are VERY USEFULL to me.

I'm trying to install on my win2000 pc Connotea.org/code since my hosting
cie is only running apache 1.3

So I'm right now insttaling Apache 2, and I'm trying to run make but it stop
after the following:

make[1]: Leaving directory `/usr/src/httpd-2.2.0/support'
make[1]: Entering directory `/usr/src/httpd-2.2.0'
/usr/local/apache2/build/libtool --silent --mode=link gcc -g -O2 -o
httpd -export-dynamic
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(libcmain.o)::
undefined reference to `_WinMain@16'
collect2: ld returned 1 exit status
make[1]: *** [httpd] Error 1
make[1]: Leaving directory `/usr/src/httpd-2.2.0'
make: *** [all-recursive] Error 1

I wen't through cygwin mailist list and a couple of solution have been
proposed, but I'm not sure where in the cygwin files it ...
SVTechie Uvach :)
SVTechie 2006-04-06 08:47:18

Sorry for late reply. I am damn busy nowadays and if u can please wait for a
day or two this will be great as I have to investigate this issue. BTW, you
have done good research on net on this issue. I can provide quick help now,

1. Follow http://sourceware.org/ml/cygwin/1999-04/msg00237.html
- Add _WinMain@16 to LIBS
- Add -DWIN32 to CFLAGS
- Above modifications has to made into Makefile (Look for LIBS, CFLAGS
in Makefile, Makefile.rules etc and add these there)
- Note: Makefiles are generated after you run configure. After you have
made changes to Makefiles, please do not run configure again.
- Try it and let me know if you still needs help. Follow second step.

2. Install Apache2 pre-built cygwin binary. Run cygwin setuop file
(setup.exe) and select Apache2 module and install. Performance loss may be
there but for now, you will be up and running. (We can work on above problem
at our leisure :)
problem installing apache
'Guest' 2006-06-15 08:01:15

hello,

I can't seem to install apache. i get an error --> could not start C:\cygwin\usr\src\apache2-2.2.2-1.sh prep

i followed all the initial install instructions from previous article.

Thanks
Login through Cygwin First
SVTechie 2006-06-15 08:32:51

Look like you are trying to run from Windows Command Prompt. That will not work. Click on Cygwin icon and one window will pop. In this, you can type most of the UNIX commands and that will work.

In this window, go to mentioned directory and then run the command.

If you do not know much about UNIX, best is not to install this way.. use EasyPHP.
re: problem installing apache
'Guest' 2006-06-16 00:23:35

no, im running it inside the cygwin shell.

when executing this --> run apache.xxx.sh prep

an error dialog box appears stating the error i mentioned.
Moved to discussion forum!
SVTechie 2006-06-16 07:59:56

I have moved and replied to this issue in the forum. Please visit
link:http://http://www.svtechie.com/cms/component/option,com_forum/Ite mid,33/page,viewtopic/t,35/

Note: You'll need to register in order to reply in discussion forum.
'Guest' 2006-07-10 09:54:36

./apache.xxx.sh prep
how to install apache 2.2.2 in windows
'Guest' 2006-07-13 06:58:15

pls help me


how to install apache2.2.2 + php5.1.4+ mysql5 in my windowsXP professional pls any mail me

my mail id : t.mathimaran@mail.com (or)
t.mathimaran@gmail.com
/usr/lib/libexpat.so: could not read sym
'Guest' 2006-08-03 04:00:24

make[3]: *** [libaprutil-1.la] Error 1
make[3]: Leaving directory `/usr/src/packages/SOURCES/httpd-2.2.3/srclib/apr-util'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/src/packages/SOURCES/httpd-2.2.3/srclib/apr-util'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/packages/SOURCES/httpd-2.2.3/srclib'
make: *** [all-recursive] Error 1
Extra dependencies
'Guest' 2006-08-06 01:59:15

Hi,

Just a note, I also had to install python, and patch just to get it running

Cheers,
waim
Bad system call - apache crashing?
'Guest' 2006-08-22 21:19:37

Very good directions, but quite an arduous process. Three hours later:

./apachectl: line 78: 5084 Bad system call $HTTPD $ARGV

Is this the apache server crashing on startup? The two oddities I found not already mentioned in the comments:

1. I had to install apr1 and aprutil1 to get it to compile and I received the following errors during make:

Info: resolving _apr_month_snames by inking to __imp__apr_month_snames (auto-import)
Info: resolving _apr_day_snames by linking to __imp__apr_day_snames (auto-import)

2. apachectl does not have an httpd2 in it to replace.

I'm not sure if I should thank you for the great directions, or curse you for giving me enough hope to go down this path. Do you have any suggestions?

Thanks,
Doug Green
douggreen at douggreenconsulting.com
Same error here
'Guest' 2006-09-01 23:56:52

I ended up with the same error as Doug:

./apachectl: line 78: 5084 Bad system call $HTTPD $ARGV

Greetings
Matt
Problem
'Guest' 2006-09-02 12:52:36

I managed to start apache2 under cygwin with "net start apache2"

It starts, though the systems thinks, it did not start and give an error.

The problem is, that it therefore cannot be stopped by "net stop apache2".

It seems, that it's impossible to make the cygwin apache2 version compatible to windows service.
'Guest' 2006-09-07 21:49:56

it might sound stupid, but i cannot really find definitions of LIBS and CFLAGS anywhere in makefile to
- Add _WinMain@16 to LIBS
- Add -DWIN32 to CFLAGS
so i did them in the file bulid/config_vars.mk, but appearently that didnt help.
could u tell me how do u guys handle this?
thanks.
B.R.
Chris

'Guest' 2006-10-12 08:31:09

ended up with the same error as Doug:

./apachectl: line 78: 5084 Bad system call $HTTPD $ARGV
'Guest' 2006-10-18 00:45:58

Hello!

If I start httpd2 with the following command (in one line), it works:

CYGWIN=server apachectl2 -k start

( from step 9 in http://lists-archives.org/cygwin/16114-problems-installing-apache-2-2- and-mod_fastcgi.html )

I changed CYGWIN from "server,codepage:oem" to "server" and now I can start httpd2 without trailing CYGWIN=.

Without expilicit setting to "server" I got the same "Bad system call".

If I install httpd2 as service with the following command, I got the "Bad system call", too.

CYGWIN=server cygrunsrv -I httpd2 -d "CYGWIN httpd2" -p /usr/sbin/httpd2 -a "-DNO_DETACH" -y cygserver -e "CYGWIN=server" -s TERM -o

The weird thing is: cygserver is running with the default settings and the global environment contains CYGWIN=server

How can I check if cygserver is *really* running (beside using "net start";)

Any idea?
Niels
'Guest' 2006-11-24 23:15:21

I can't even get past the prep stage.

$ ./apache2-2.2.2-1.sh prep
.
(extracts files)
(patches files)
.
found apr source: srclib/apr
found apr-util source: srclib/apr-util
rebuilding srclib/apr/configure
buildconf: checking installation...
buildconf: python version 2.1 (ok)
buildconf: autoconf version 2.60 (ok)
buildconf: libtool not found.
You need libtool version 1.4 or newer installed to build APR from SVN.
./buildconf failed for apr

$ which libtool
/usr/bin/libtool

$ libtool --version

ltmain.sh (GNU libtool) 1.5.23a (1.1220.2.412 2006/10/13 14:13:30)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Something has broke recently in the version detection of libtool? Or am I missing something here?
'Guest' 2007-02-22 05:21:04

I had the same Winmain@16 issue and couln't manage to compile it properly (couln't find where to define LIBS and CFLAGS).
I succeeded in installing the apache2 package from Cygwin setup, then following instructions at http://www.issociate.de/board/post/237301/apache2_does_not_start_in_cy gwin.html.
I nevertheless had to install the rebase package and run rebaseall command to fix a .so alignment issue on apache2ctl start.

Good luck.
'Guest' 2007-03-06 11:56:22

can anyone tell me y when i type ./configure my computer will run all the files for quite a time then freeze and won't go farter
help
'Guest' 2007-03-06 16:16:13

make[1]: Leaving directory `/usr/src/packages/SOURCES/httpd-2.2.3/srclib'
make: *** [all-recursive] Error 1
HELP ME
'Guest' 2007-03-06 16:17:28

installing in linux take forever and i keep getting this error

make[1]: Leaving directory `/usr/src/packages/SOURCES/httpd-2.2.3/srclib'
make: *** [all-recursive] Error 1
RECURSIVE ERROR
'Guest' 2007-03-06 19:39:20

HOW TO I FIX THIS RECURSIVE ERRORS THAT KEEP POPPING UP LIKE CRAZY
suneelsp 2007-09-07 03:12:24

ended up with the same error as Doug:

./apachectl: line 78: 5084 Bad system call $HTTPD $ARGV
Only registered users can write comments!
Last Updated on Thursday, 30 March 2006 19:56