I’ve documented two ways of installing Apache. One where the default Apache Snow Leopard install is overwritten with your own version (the Darwin layout). A second one, the DIYMacServer layout, where the default install is left alone completely (it uses the same directory for the webpages, but a different location for the binaries, configuration and logfiles). The difference in the configuration is decided with the '-enable-layout‘ option during configuration.
If you select the default Darwin layout skip the next bit until the configuration fase (please note that the rest of the instruction on this site are based on the DIYMacServer layout!). Otherwise continue reading.
For the DIYMacServer layout we need to edit some configuration files in the Apache source directory before we can start. First copy the layout below and add it to the ‘config.layout’ file in source directory.
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>
Next you need to add the following layout to the config.layout files in these locations:
- ./srclib/apr/config.layout
- ./srclib/apr-util/config.layout
prefix: /usr/local/apache2
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/bin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/libexec+
mandir: ${prefix}/share/man
sysconfdir: /etc/httpd
datadir: /Library/Webserver
installbuilddir: ${datadir}/build
includedir: ${prefix}/include
localstatedir: /var
runtimedir: ${localstatedir}/run
</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.
./configure -enable-layout=DIYMacServer \
-enable-mods-shared=all \
-with-ssl=/usr \
-with-mpm=prefork \
-disable-unique-id \
-enable-ssl \
-enable-dav \
-enable-cache \
-enable-proxy \
-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 which you can’t explain, please post you questions and the error into the forum on this site:
Next step: Configuring Apache on Snow Leopard



12:43 am
I try to compile Apache with the Darwin layout with the following configuration :
# CFLAGS=”-arch x86_64″ ./configure –enable-layout=Darwin –enable-module=most –enable-mods-shared=all –enable-proxy –enable-cache –enable-cgi –enable-deflate –enable-logio –disable-unique-id –with-mpm=prefork –with-included-apr
# make
# make install
But when try to start Apache I have the following error :
# apachectl restart
dyld: Symbol not found: _apr_md4_set_xlate
Referenced from: /usr/bin/httpd
Expected in: /usr/lib/libaprutil-1.0.dylib
in /usr/bin/httpd
/usr/bin/apachectl: line 78: 26698 Trace/BPT trap $HTTPD -k $ARGV
Apache is running, but I didn’t know what this error is about …
Any idea ?
Thx for your help.
PS :
Inside /usr/lib I have :
-rwxr-xr-x 1 root wheel 180848 Sep 8 20:56 libaprutil-1.0.3.9.dylib*
lrwxr-xr-x 1 root wheel 24 Sep 8 20:56 libaprutil-1.0.dylib@ -> libaprutil-1.0.3.9.dylib
6:43 am
@Olivier, you need to use ’sudo make install’ else you won’t have enough rights to update the libraries.
1:58 pm
I was doing all in root. That’s what the # prompt mean.
Otherwise I found the problem, the ‘make install’ script install the httpd binary in /usr/sbin and the default apachectl use the one in /usr/bin.
So I have manually copied the httpd in the correct place.
But actually I run into another problem, more complex with php5 compilation.
I will post a comment in your article concerning php.
2:55 pm
Olivier, you should not do everything in root. I know it’s easier but it’s also very dangerous and not common practice.
I will have a look at the layout of Darwin, it looks like it is no longer correct.
3:41 pm
Edit configuration files in the Apache source with
Trying to compile Apache (httpd-2.2.13)
When I run the configuration script, I get:
# ./configure -enable-layout=DIYMacServer \
> -enable-mods-shared=all \
> -with-ssl=/usr \
> -with-mpm=prefork \
> -disable-unique-id \
> -enable-ssl \
> -enable-dav \
> -enable-cache \
> -enable-proxy \
> -enable-logio \
> -enable-deflate \
> -with-included-apr \
> -enable-cgi \
> -enable-cgid \
> -enable-suexec
./config.pld: line 1: ?: command not found
./config.pld: line 2: ?: command not found
./config.pld: line 3: ?: command not found
./config.pld: line 4: ?: command not found
./config.pld: line 5: ?: command not found
./config.pld: line 6: ?: command not found
./config.pld: line 7: ?: command not found
./config.pld: line 8: ?: command not found
./config.pld: line 9: ?: command not found
./config.pld: line 10: ?: command not found
./config.pld: line 11: ?: command not found
./config.pld: line 12: ?: command not found
./config.pld: line 13: ?: command not found
./config.pld: line 14: ?: command not found
./config.pld: line 15: ?: command not found
./config.pld: line 16: ?: command not found
./config.pld: line 17: ?: command not found
./config.pld: line 18: ?: command not found
./config.pld: line 19: ?: command not found
./config.pld: line 20: ?: command not found
checking for chosen layout… DIYMacServer
checking for working mkdir -p… yes
checking build system type… i386-apple-darwin10.0.0
checking host system type… i386-apple-darwin10.0.0
checking target system type… i386-apple-darwin10.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
Trying to get a fresh copy of Snow Leopard up and running with MAMP-64bit.
Thanks,
7:17 pm
Brian, there are some unwanted characters in the stuff you copied from the site which will cause this error. Try to use Safari or else copy the text first in a text editor and check it before pasting it in the Terminal.
2:21 pm
I’m getting exactly the same error as Brian. This is a clean install of just Mac OS X 10.6.1 with Xcode 3.2.1 and then using your instructions have got this far. I have double, triple and quadruple checked your text versus what I am pasting/typing manually and after trying this many, many times as both an administrator and as root I always get the same error. Using BBedit as text editor and using Safari as web browser. Clearly something is wrong here but I have no idea what… Any help appreciated!
3:21 pm
Update: Meticulously and MANUALLY TYPED OUT rather than copying and pasting everything from this web page. Triple checked all the manual typing in all three individual files before saving and then entered (manually) the configuration script. It finally worked. Recommendation – do NOT copy and paste the text from this web page – you have to type everything out so as to avoid whatever character is being swapped out by the browser/text editor!
7:51 pm
@Graham, It’s impossible for me to test this with every editor. It works perfectly if you just use the Terminal and VI which is something everybody has and can use. Especially if your server is at a remote site.
I would think you can have a look at the settings of BBEdit in how it pastes the Text. I myself use Espresso and that does not have your problem.
1:34 am
Please Make sure to change the links to the next steps. The link to configuring Apache on Snow Leopard takes me to the Leopard configuration page. This has happened on several pages already. No big deal, just throws me off focus a little bit, and I need all the focus I can get… Great tutorial though.
9:10 am
@Mark, the configuration for Apache is the same on both platforms. I’ll put a notice up for that.
1:55 am
I followed the DIYMacServer layout, and got the following error after running “make”:
Making all in support
/opt/extract/httpd-2.2.14/srclib/apr/libtool –silent –mode=link gcc -g -O2 -L/usr/lib -o htpasswd htpasswd.lo /opt/extract/httpd-2.2.14/srclib/pcre/libpcre.la /opt/extract/httpd-2.2.14/srclib/apr-util/libaprutil.la -lexpat -liconv /opt/extract/httpd-2.2.14/srclib/apr/libapr.la -lpthread
Undefined symbols:
“_apr_stat$INODE64″, referenced from:
_exists in htpasswd.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [htpasswd] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
Can anyone help?
Thanks.
Rob