Unpack the downloaded archive and edit the file ‘config.layout’ you will find there. Add the following lines to the file at the bottom or download a ready made file from the resources section at the bottom of this page:
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/Documents
installbuilddir: ${datadir}/build
errordir: ${datadir}/error
iconsdir: ${datadir}/icons
htdocsdir: /Library/WebServer/Documents
manualdir: ${datadir}/manual
cgidir: /Library/WebServer/CGI-Executables
includedir: ${prefix}/include
localstatedir: /var
runtimedir: ${localstatedir}/run
logfiledir: ${localstatedir}/log/httpd
proxycachedir: ${localstatedir}/proxy
</Layout>
When you saved the additional Layout which defines what goes where you’re ready to continue. I’ll explain what we have defined here, in this layout we decide what goes where when you install Apache. The software (binaries and such) go into ‘/usr/local/apache2‘. All the log-files go into ‘/var/log/httpd‘. The runtime dependancies (like the pid file) go into ‘/var/run‘ and I’ve decided to re-use the original Mac OSX directories for the websites and the CGI files. They will end up in ‘/Library/WebServer/‘
Open a Terminal session enter the directory in which you extracted the archive and edited the ‘config.layout’. Use a normal user to execute the following the commands, please note difference for Intel or PowerPC based Mac’s:
For Intel:
./configure --enable-layout=DIYMacServer \
--enable-mods-shared=all \
--with-ssl=/usr \
--with-mpm=prefork \
--enable-ssl \
--enable-dav \
--enable-cache \
--enable-proxy \
--disable-unique-id \
--enable-logio \
--enable-deflate \
--with-included-apr \
--enable-ldap \
--enable-cgi \
--enable-cgid \
--enable-suexec
For PowerPC:
./configure --enable-layout=DIYMacServer \
--enable-mods-shared=all \
--with-ssl=/usr \
--with-mpm=prefork \
--enable-ssl \
--enable-dav \
--enable-cache \
--enable-proxy \
--disable-unique-id \
--enable-logio \
--enable-deflate \
--with-included-apr \
--enable-ldap \
--enable-cgi \
--enable-cgid \
--enable-suexec
and follow with:
If these processes end without error you are ready to install Apache. To make sure you get the new version 2 configuration set please copy the original configuration to a safe place using:
Then complete the install using the following command:
Apache is now installed in ‘/usr/local/apache2‘, your websites html and php should be located in ‘/Library/WebServer/Documents‘. You can configure your web server with the ‘httpd.conf‘ located in ‘/etc/httpd‘
To start the new webserver, make sure the default Mac OS X version is turned off, use:
Next step: Configuring Apache on Tiger



9:17 pm
sudo /usr/local/apache2/bin/apachectl start
httpd: Syntax error on line 207 of /etc/httpd/httpd.conf: Cannot load /usr/libexec/httpd/mod_log_config.so into server: Symbol not found: _ap_month_snames\n Referenced from: /usr/libexec/httpd/mod_log_config.so\n Expected in: flat namespace\n
I followed this setup from beginning till starting Apache on Mac mini intel duo core, Mac os X 10.4.8
Any idea why I have problems with mod_log_config.so ?
10:22 pm
Do you still have the original httpd.conf from the original Apache
install or did you upgrade that as well. You are including Apache 1.x
modules from the old configuration.
I missed that in the documentation (will correct it), please copy from
the Apache source directory httpd-2.2.4/docs/conf into /etc/httpd (make
a copy of the originals for safekeeping)
PS. Christophe, my email to you is getting bounced ?
9:04 pm
It works now, what I did before the make command:
> mv /etc/httpd /etc/httpd.old
> make
> sudo make install
> sudo /usr/local/apache2/bin/apachectl start
No more errors
It seems that the install won’t overwrite your initial config files pointing to the older modules used by the default apache delivered with OS X.
5:43 pm
If you get a CFLAGS error, be sure you’re in the bash shell and not tcsh (and have the latest XCODE installed)
5:39 pm
Why enable some modules (ie: dav & ssl) when they are alrady enabled by using –enable-mods-shared=all?
6:00 pm
Really don’t know anymore, so it’s a good question. I’ll look into it…
10:34 pm
How do we compile in such a way that we get mod_unique_id as a module installed?
7:46 pm
Add –enable-unique-id to the configure statement and re-compile.
5:47 pm
Ok, got enable-unique-id installed trying to install mod_security2 and I’m having problems
i think it’s a problem with libxml2
Cannot load /usr/lib/libxml2.so into server: cannot create object file image or add library
any thoughts?
2:24 pm
To make it compile under 10.5, one must change the -isysroot flag to “/Developer/SDKs/MacOSX10.5.sdk”, and set the APR_HAS_SENDFILE to 0 (line 220) in the file srclib/apr/include/apr.h before configuring & making binaries.
4:12 pm
Julien, you just beat me to it, I was going change the documentation to reflect these issues. I will do this later.
9:15 am
Hi there,
I made the change to -isysroot flag as I’m running 10.5, but I couldn’t find the file “srclib/apr/include/apr.h” I decided to try it like this but I got an error, so I went back and rename “srclib/apr/include/apr.h.in” to “srclib/apr/include/apr.h” and uncomment the APR_HAS_SENDFILE and set it’s value to cero; but again I got the same error.
/config.pld: line 2:
# Classical Apache path layout.: command not found
./config.pld: line 23: unexpected EOF while looking for matching `”
./config.pld: line 24: syntax error: unexpected end of file
checking for chosen layout… Alberto
checking for working mkdir -p… yes
checking build system type… i386-apple-darwin9.0.0
checking host system type… i386-apple-darwin9.0.0
checking target system type… i386-apple-darwin9.0.0
Configuring Apache Portable Runtime library …
configuring package in srclib/apr now
configure: error: expected an absolute directory name for –bindir: NONE/bin
configure failed for srclib/apr
d142-179-120-244:httpd-2.2.6 alberto$
I need some help, please.
9:57 am
First run the configure statement, then change the apr.h and then run make!
4:06 am
Ok, I found one of the errors… don’t use TextEdit for editting your file or your end of line are going to be totally different!
I finally saw some progress but still is not running. Here are the steps that I’m following:
1) config.layout
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
2) execute command:
CFLAGS=”-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk” \
./configure –enable-layout=DIYMacServer \
–enable-mods-shared=all \
–with-ssl=/usr \
–with-mpm=prefork \
–enable-ssl \
–enable-dav \
–enable-cache \
–enable-proxy \
–enable-shared \
–disable-static \
–disable-unique-id \
–disable-ipv6 \
–enable-logio \
–enable-deflate \
–with-ldap \
–with-ldap-include=/usr/include \
–with-ldap-lib=/usr/lib \
–with-included-apr \
–enable-ldap \
–enable-auth-ldap \
–enable-cgi \
–enable-cgid \
–enable-suexec
3) Edit apr.h:
Change #define APR_HAS_SENDFILE 1 to #define APR_HAS_SENDFILE 0 in line 220
4) make
5) sudo make install
7) sudo /usr/local/apache2/bin/apachectl start
httpd: Syntax error on line 207 of /etc/httpd/httpd.conf: Cannot load /usr/libexec/httpd/mod_log_config.so into server: cannot create object file image or add library
8)sudo cp docs/conf/httpd.conf /etc/httpd/
d142-179-120-244:httpd-2.2.6
9)sudo /usr/local/apache2/bin/apachectl start
httpd: Syntax error on line 29 of /etc/httpd/httpd.conf: ServerRoot must be a valid directory
At this point I don’t know how my installation is, which files have been modified, which ones I have moved :_(
I’m totally lost, what should I do next? uninstall and reinstall? how do I uninstall a program in Mac?
I really appreciate all the help that you are giving me
PS: I try to run the configure process again and this is the error that I get
-bash: ./configure: No such file or directory
8:26 am
I’ve send you an email describing the process step by step again, I’ve even made a separate blogpost to describe the compilation of Apache on Leopard.
8:04 pm
Thank you very much Richard for all this help. Would you mind to resend me the email, I didn’t receive it and is not even in my junk mail box.
The other blogpost that are you talking about is “Compiling Apache on Leopard : 11/17″?
8:55 pm
It’s been resend, and yes you are correct on the blogpost!
12:12 am
I am trying to get apache 2.2.8 compiled on mac os x 10.4.11 and when I run the PPC CFLAGS stuff I get the following:
./configure: line 1:  : command not found
./configure: line 2:  : command not found
./configure: line 3:  : command not found
./configure: line 4:  : command not found
./configure: line 5:  : command not found
./configure: line 6:  : command not found
./configure: line 7:  : command not found
./configure: line 8:  : command not found
./configure: line 9:  : command not found
./configure: line 10:  : command not found
./configure: line 11:  : command not found
./configure: line 12:  : command not found
./configure: line 13:  : command not found
./configure: line 14:  : command not found
./configure: line 15:  : command not found
./configure: line 16:  : command not found
./configure: line 17:  : command not found
./configure: line 18:  : command not found
./configure: line 19:  : command not found
./configure: line 20:  : command not found
checking for chosen layout… DIYMacServer
checking for working mkdir -p… yes
checking build system type… powerpc-apple-darwin8.11.0
checking host system type… powerpc-apple-darwin8.11.0
checking target system type… powerpc-apple-darwin8.11.0
Configuring Apache Portable Runtime library …
configuring package in srclib/apr now
configure: error: expected an absolute directory name for –bindir: NONE/bin
configure failed for srclib/apr
12:43 pm
Gidday,
When I ran make (i386, Tiger 10.4, Apache 2.2.9) it failed with errors on util_ldap.c:
util_ldap.c:41:2: error: #error mod_ldap requires APR-util to have LDAP support built in
util_ldap.c: In function ‘util_ldap_handler’:
util_ldap.c:102: error: ‘util_ldap_state_t’ undeclared (first use in this function)
util_ldap.c:102: error: (Each undeclared identifier is reported only once
util_ldap.c:102: error: for each function it appears in.)
util_ldap.c:102: error: ‘st’ undeclared (first use in this function)
util_ldap.c:102: error: parse error before ‘)’ token
util_ldap.c: At top level:
util_ldap.c:136: error: parse error before ‘*’ token
util_ldap.c: In function ‘uldap_connection_close’:
… (500 lines or so)
I removed the “–enable-ldap” directive and the make didn’t have these errors. I found http://marc.info/?l=apache-httpd-users&m=116109145131564&w=2 which suggested “First compile apr-util module with "–with-ldap”. How do you do this? Or is there an alternate way around this problem?
Thanks,
Brooke
6:45 am
I am running OS X 10.4.11 on a Quicksilver 2002 800 mhz. I have been having a hard time getting –enable-ldap to work with apache 2.2.8, then ran into an article ( http://marc.info/?l=apache-httpd-users&m=116109145131564&w=2 ) that said you had to install apr and apr-util first. The included apr will not work. The apr-util has to be configured –with-ldap. I did it and apache 2.2.8 installed fine.
You can also start apache with the preference panel.
cd /usr/sbin.
mv apachctl apachctl.org
ln -s /usr/local/sbin/apachctl apachctl
In httpd.conf file go to the bottom and uncomment
Include etc/httpd/extra/httpd-mpm.conf
in httpd-mpm.conf change
PidFile “var/run/httpd.pid” to PidFile “/var/run/httpd.pid”.
httpd-mpm.conf is located in the extra folder
Go to the preference pane and start Personal Web Sharing.
The below file structure is how I set up my config.layout
prefix: /usr/local
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/sbin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/libexec/httpd
mandir: ${prefix}/share/man
sysconfdir: ${prefix}/etc/httpd
datadir: /Library/WebServer
installbuilddir: ${prefix}/share/httpd/build
errordir: ${prefix}/share/httpd/error
iconsdir: ${prefix}/share/httpd/icons
htdocsdir: ${datadir}/Documents
manualdir: /Library/Documentation/Services/apache
cgidir: ${datadir}/CGI-Executables
includedir: ${prefix}/include/httpd
localstatedir: ${prefix}/var
runtimedir: ${localstatedir}/run
logfiledir: ${localstatedir}/logs
proxycachedir: ${localstatedir}/proxy
6:58 am
Dowload the current apr and apr-util from the apache web site.
Uncompress the files.
cd apr-1.?.? folder.
CFLAGS=”-arch ppc” ./configure –quiet && make && sudo make install
make note of where apr is installed!
cd ../apr-util-1.?.?
CFLAGS=”-arch ppc” \
./configure –quiet \
–with-apr=’the folder where apr was installed’ \
–with-ldap \
–with-ldap-include=/usr/include \
–with-ldap-lib=/usr/lib
make && sudo make install
you can then configure apache with –enable-ldap
12:39 am
-bash: ./configure: No such file or directory
I am a novice, and this is my first time trying to do any programming, beside small scripts years ago on IRC. any way, I have tried entering your code copy and paste, typing all by hand, line by line. I have no idea what I’m doing. I thought this $60 book was going to make me and expert programmer, and I can’t even install the software.