Compiling Apache Web Server on Mac OS X
For whatever the reason might be that you need to compile Apache on Mac OS X (likely because I linked you here from another one of my blogs
), the steps are really simple.
Developer Tools
First things first! If you don't have a copy of Developer Tools installed then install it! Apple's Developer Tools will provide you with a number of required stuff to help us compile programs. (Later if you got a minute its fun to poke through it and see what cool Apps Apple just gave you for free.). You should be able to find it in one of your CDs that comes with your computer or OS X purchase. If you have a broadband connection you can download the latest version from ADC (Apple's Developer Connection) for free by going to http://developer.apple.com.
Apache
Next we'll need to obtain the latest version of Apache Web server by going to http://httpd.apache.org/download.cgi. Download the latest Unix source of Apache (2.2.8 as of this writting) compressed in tar.gz format. Once that is complete open up a terminal window in the directory where you downloaded Apache and type the following commands:
$ tar -xvzf httpd-2.28.tar.gz
$ cd httpd-2.2.8
$ ./configure --enable-layout=Darwin --enable-mods-shared=all
$ make
$ sudo make install
You will need to have the root password handy with the last command in order to install Apache unless you modified the configure command to build in a directory you have permissions to. I would advise to leave the configure command as is so that you will still have the ability to stop/start Apache from your System Preference's Sharing module.
If you are a Terminal junkie like myself you could use /usr/sbin/httpd or /usr/sbin/apachectl to stop/start/restart apache from the command line. Read the man pages for more info how.
That about sums it up! Told ya it was really simple!
June 18th, 2008 at 7:21 am
Help! I started with this tutorial but it did not work so I went to you tutorial next. Now I’m getting the following error when trying to restart Apache.
http://macoshelp.blogspot.com/2008/02/adding-gd-library-for-mac-os-x-leopard.html
httpd: Syntax error on line 115 of /etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/libphp5.so into server:
July 7th, 2008 at 9:02 am
I believe its because you need to recompile PHP for this new version of Apache because your old version of PHP was compiled against another version of Apache. If you follow this guide you should be ok.
http://www.richard-sumilang.com/blog/2008/03/29/compiling-php-on-mac-os-x/
September 10th, 2008 at 2:44 am
Not so simple! I get:
…
checking for APR-util… yes
adding “-L/usr/lib” to LDFLAGS
checking for gcc… gcc
checking for C compiler default output file name…
configure: error: C compiler cannot create executables
See `config.log’ for more details.
The config.log contains
…
configure:4466: $? = 0
configure:4473: gcc -v >&5
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5484~1/src/configure –disable-checking -enable-werror –prefix=/usr –mandir=/share/man –enable-languages=c,objc,c++,obj-c++ –program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ –with-gxx-include-dir=/include/c++/4.0.0 –with-slibdir=/usr/lib –build=i686-apple-darwin9 –with-arch=apple –with-tune=generic –host=i686-apple-darwin9 –target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5484)
configure:4477: $? = 0
configure:4484: gcc -V >&5
gcc-4.0: argument to `-V’ is missing
configure:4488: $? = 1
configure:4511: checking for C compiler default output file name
configure:4533: gcc -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp -L/usr/lib conftest.c >&5
ld: library not found for -lcrt1.10.5.o
collect2: ld returned 1 exit status
configure:4537: $? = 1
configure:4575: result:
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME “”
| #define PACKAGE_TARNAME “”
| #define PACKAGE_VERSION “”
| #define PACKAGE_STRING “”
| #define PACKAGE_BUGREPORT “”
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:4582: error: C compiler cannot create executables
I’m using Mac OS X 10.5.4 with Xcode 3.1 Developer Tools. I put /Developer/usr/bin on my path to get gcc.
What’s up?
Thanks,
Bruno.