I’ve documented two ways of installing Apache. One where the default Apache Leopard install is overwritten with your own version. A second one, the DIYMacServer install, where the default install is left alone completely (it uses the same directory for the webpages, but a different location for the configuration). The difference in the configuration is made in the ‘config.layout’ file which determines where all the packages should be installed. For both methods copy the layout below and add it to the ‘config.layout’ file.
The Darwin install will keep the functionality of the preference pane intact. The DIYMacServer install is used in all the other documentation in this site. You choose !
DIYMacserver installation configuration
prefix: /usr/local/apache2
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/bin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/modules
mandir: ${prefix}/man
sysconfdir: /etc/httpd
datadir: /Library/Webserver
installbuilddir: ${datadir}/build
errordir: ${datadir}/error
iconsdir: ${datadir}/icons
htdocsdir: ${datadir}/Documents
manualdir: ${datadir}/manual
cgidir: ${datadir}/CGI-Executables
includedir: ${prefix}/include
localstatedir: /var
runtimedir: ${localstatedir}/run
logfiledir: ${localstatedir}/log/httpd
proxycachedir: ${runtimedir}/proxy
</Layout>
Leopard installation configuration
prefix: /usr
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/sbin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/libexec+
mandir: ${prefix}/share/man
sysconfdir: /etc+
datadir: /Library/Webserver
installbuilddir: ${prefix}/share/httpd/build
errordir: ${prefix}/share/httpd/error
iconsdir: ${prefix}/share/httpd/icons
htdocsdir: ${datadir}/Documents
manualdir: ${datadir}/share/httpd/manual
cgidir: ${datadir}/CGI-Executables
includedir: ${prefix}/include+
localstatedir: /var
runtimedir: ${localstatedir}/run
logfiledir: ${localstatedir}/log+
proxycachedir: ${runtimedir}/proxy
</Layout>
If you’ve edited the ‘config.layout’ file to add DIYMacServer (the Darwin layout is already in the file) you are ready to run the configuration script. Change the ‘–enable-layout’ to reflect your choice in configuration. So fill in either DIYMacServer or Darwin to choose, the example uses DIYMacServer as the layout.
--enable-mods-shared=all \
--with-ssl=/usr \
--with-mpm=prefork \
--disable-unique-id \
--enable-ssl \
--enable-dav \
--enable-cache \
--enable-logio \
--enable-deflate \
--with-included-apr \
--enable-cgi \
--enable-cgid \
--enable-suexec
You can now run:
and if it all goes well:
If you run into errors or some strange thig happens which you can’t explain, please post you questions and the error into the forum on this site:
Next step: Configuring Apache on Leopard



2:59 am
You say “You can now run: make”
How does one do that? Sorry…new to Mac. Thanks.
7:30 am
Open a terminal and type: “make” and press enter.
4:22 pm
Oh…thanks.
2:12 pm
Hi,
everything compiles without any problem. Troubles comes when link stage starts:
/Users/alvise/src/httpd-2.0.63/srclib/apr/libtool –silent –mode=link gcc -g -O2 -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp -DAP_HAVE_DESIGNATED_INITIALIZER -I/Users/alvise/src/httpd-2.0.63/srclib/apr/include -I/Users/alvise/src/httpd-2.0.63/srclib/apr-util/include -I. -I/Users/alvise/src/httpd-2.0.63/os/unix -I/Users/alvise/src/httpd-2.0.63/server/mpm/prefork -I/Users/alvise/src/httpd-2.0.63/modules/http -I/Users/alvise/src/httpd-2.0.63/modules/filters -I/Users/alvise/src/httpd-2.0.63/modules/proxy -I/Users/alvise/src/httpd-2.0.63/include -I/Users/alvise/src/httpd-2.0.63/modules/generators -I/Users/alvise/src/httpd-2.0.63/modules/dav/main -export-dynamic -o httpd modules.lo modules/aaa/mod_access.la modules/aaa/mod_auth.la modules/filters/mod_include.la modules/loggers/mod_log_config.la modules/metadata/mod_env.la modules/metadata/mod_setenvif.la modules/http/mod_http.la modules/http/mod_mime.la modules/generators/mod_status.la modules/generators/mod_autoindex.la modules/generators/mod_asis.la modules/generators/mod_cgi.la modules/mappers/mod_negotiation.la modules/mappers/mod_dir.la modules/mappers/mod_imap.la modules/mappers/mod_actions.la modules/mappers/mod_userdir.la modules/mappers/mod_alias.la modules/mappers/mod_so.la server/mpm/prefork/libprefork.la server/libmain.la os/unix/libos.la /Users/alvise/src/httpd-2.0.63/srclib/pcre/libpcre.la /Users/alvise/src/httpd-2.0.63/srclib/apr-util/libaprutil-0.la -lexpat -liconv /Users/alvise/src/httpd-2.0.63/srclib/apr/libapr-0.la -lresolv -lpthread
Undefined symbols:
“_apr_sendfile”, referenced from:
_core_output_filter in libmain.a(core.o)
_ap_hack_apr_sendfile in libmain.a(exports.o)
“_apr_socket_sendfile”, referenced from:
_ap_hack_apr_socket_sendfile in libmain.a(exports.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [httpd] Error 1
make: *** [all-recursive] Error 1
I’ve installed apr and aprutils in my machine:
alvise@imac-di-alvise-dorigo 15:09:04 ~/src/httpd-2.0.63>ls /opt/local/lib/libapr*
/opt/local/lib/libapr-0.0.9.17.dylib /opt/local/lib/libapr-1.la /opt/local/lib/libaprutil-0.dylib
/opt/local/lib/libapr-0.0.dylib /opt/local/lib/libapriconv-1.0.2.1.dylib /opt/local/lib/libaprutil-0.la
/opt/local/lib/libapr-0.a /opt/local/lib/libapriconv-1.0.dylib /opt/local/lib/libaprutil-1.0.3.2.dylib
/opt/local/lib/libapr-0.dylib /opt/local/lib/libapriconv-1.a /opt/local/lib/libaprutil-1.0.dylib
/opt/local/lib/libapr-0.la /opt/local/lib/libapriconv-1.dylib /opt/local/lib/libaprutil-1.a
/opt/local/lib/libapr-1.0.3.2.dylib /opt/local/lib/libapriconv-1.la /opt/local/lib/libaprutil-1.dylib
/opt/local/lib/libapr-1.0.dylib /opt/local/lib/libaprutil-0.0.9.17.dylib /opt/local/lib/libaprutil-1.la
/opt/local/lib/libapr-1.a /opt/local/lib/libaprutil-0.0.dylib
/opt/local/lib/libapr-1.dylib /opt/local/lib/libaprutil-0.a
Any Idea ? thank you
Alvise
3:30 am
OK, so compiling failed (just as it did trying to compile mySQL) because, I think, of this line in the output:
no acceptable C compiler found in $PATH
How/where do I get a C compiler? This is a brand new mini running 10.5.4. Thanks.
1:32 pm
Craig, please install the X-Code tools from the Leopard install disc. That will install everything that is required.
6:58 pm
I can compile it and install it no problem.
The trouble is with trying to control it.
if I do whereis apachectl, it’s in /usr/sbin/ , not /usr/local/apache2/bin/
So…Apache runs, but not the installation we’re doing here.
I then have the same problem with PHP 5, it runs, but not the version I compiled/installed.
Help!
7:57 pm
John, if you compiled and installed it succesfully you should also have an apachectl in /usr/local/apache2/bin/ . The one you are using in /usr/bin/ is the original apache installation
9:48 pm
[...] skriver över den befintliga Apachen, så det blir precis som original om man säger så Använde denna hjälpsamma guide och använde sedan dessa [...]
10:06 pm
Well I just noticed that apache version 2.2.9 (atleast) have the config
./configure –enable-layout=Darwin
available which mirrors your Leopard, so if ppl think editing configure.layout is a hassle, no need as long as you intended the “leopard”/”Darwin” one =P
6:33 am
You are correct, Darwin is exactly as Leopard. I will change the documentation.
4:44 am
Apache was broken on my machine when I recently installed Leopard. I followed your instructions to re-install Apache and it worked like a charm. Many thanks Richard.
10:25 am
Hi All-
When trying to start apache after following the instructions, I received the following eror. Please Help. Many Thanks, Justin
Syntax error on line 117 of /usr/local/apache2/conf/httpd.conf:Invalid command ‘Order’, perhaps misspelled or defined by a module not included in the server configuration
11:36 am
You are starting a incorrect Apache installation as the configuration should be in /etc/httpd/ and not in /usr/local/apache2/conf/. I guess something went wrong with installing or you are combining different setups/installation instructions together.
4:42 am
Hi Richard-
Thanks for the help. What is the best way to star over again and give things another shot without having to completely reinstall Leopard?
Thanks,
Justin
9:19 am
The simplest way to start over again is to remove the directory ‘/usr/local/apache2/’ and start from the beginning.
12:02 pm
Sorry to be an idea, I don’t know where to put these commands?
./configure –enable-layout=Darwin \?–enable-mods-shared=all \?–with-ssl=/usr \?–with-mpm=prefork \?–disable-unique-id \?–enable-ssl \?–enable-dav \?–enable-cache \?–enable-logio \?–enable-deflate \?–with-included-apr \?–enable-cgi \?–enable-cgid \?–enable-suexec
Do they go in the config file? A separate file? Run them in terminal? Where do I put them?
12:05 pm
You need to enter them in the Terminal! Open a terminal session, cd into the apache source directory and copy the commands.
12:27 pm
That was fast. Now that you know I am an idiot, help me with this one. I get an error in terminal “configure: error: invalid variable name: –enable-mods-shared”
I am working with Apache2.2.11.
12:35 pm
The only things I can think of are: typo or Xcode (development tool) is not installed
12:40 pm
Ok, I am rebuilding a machine remotely, and appears xcode not installed. Sorry to continue to be an idiot, but what does xcode do? Why is it needed?
12:41 pm
XCode is the development environment for Mac OSX and includes all the compiler stuff and header files required for building software. You are building apache from source so you need a compiler!
12:46 pm
Thanks so much for your help…you have no idea how much I appreciate it. I will send a donation your way in the next day or so.
12:48 pm
Thanks so much for your help…you have no idea how much I appreciate it.
1:33 pm
Well, after all that, same error. I downloaded and installed xcode, rebooted, checked and double checked the spelling of the script, cd’d into the correct directory, pasted in the script and get the same error. The other option would be try to load module by module? I have a list of the modules in the old httpd.conf file - would that work?
1:41 pm
Doug, please check your mail and use that medium for now. Once we’ve solved the problem I’ll post the outcome here.