Bookmark and Share

Rebuilding MAMP stack from scratch.

Posted: Sunday, May 3rd, 2009 at 8:52 amUpdated: Monday, May 4th, 2009 at 10:41 pm

At this point, I assume that you already have MySQL instaled and working properly. Let’s get to the next step and recompile Apache.

Compiling Apache on Mac OS X

On my Mac OS X 10.5 Leopard, the Apache that’s installed by default is version 2.2.9. This step is optional. I’m actually happy with my Apache, but I find it good to know how to compile Apache to replace the default installation.

First, we need to find out the options that were used to configure the built in Apache. From Apache’s guide to upgrading, there’s a file called config.nice that has the information of configure flag of the installed version. Let’s find where it is on our Mac OS X.

user:~ user$ locate config.nice
/usr/share/httpd/build/config.nice
user:~ user$ 

For me, the config.nice file is something like below.

#! /bin/sh
#
# Created by configure

"./configure" \
"--prefix=/usr" \
"--enable-layout=Darwin" \
"--with-apr=/usr" \
"--with-apr-util=/usr" \
"--enable-mods-shared=all" \
"--enable-ssl" \
"--enable-cache" \
"--enable-mem-cache" \
"--enable-proxy-balancer" \
"--enable-proxy" \
"--enable-proxy-http" \
"--enable-disk-cache" \
"--enable-so" \
"$@"

Take a look at the configuration option that came with your Mac. In all likelihood, that should be sufficient. If you need more options, you can always pass –help on configure command to list all the possible options.

Next is to download Apache source from here. Since we’ll be compiling ourselves, download the source version. Here’s my session when compiling Apache.

user:compile user$ wget http://apache.ziply.com/httpd/httpd-2.2.11.tar.gz
user:compile user$ tar -zxvf httpd-2.2.11.tar.gz
user:compile user$ cd httpd-2.2.11
user:httpd-2.2.11 user$ /usr/share/httpd/build/config.nice
user:httpd-2.2.11 user$ make
user:httpd-2.2.11 user$ sudo make install
user:httpd-2.2.11 user$ 

Notes on my session compiling Apache on Mac OS X

  1. Change your download mirror to whichever closest to you.
  2. Like I said above, I’m actually happy with the default installation of Apache. Thus, I don’t have the need to add more options. That’s why I simply run the old config.nice file. If you want to add features from the default Apache configuration, run the following command and add more flags as you see fit.
    user:httpd-2.2.11 user$ ./configure --help | less
    
  3. If you’re removing options from the original config.nice file, my suggestion is to at least keep the location options (prefix, enable-layout, with-apr, with-apr-util)

Once you’re done with the installation, restart Apache by issuing the command below, or by going to Sharing on System Preferences and unchecking then checking the Web Sharing option.

user:httpd-2.2.11 user$ sudo apachectl restart
/usr/sbin/apachectl restart: httpd restarted
user:httpd-2.2.11 user$ 

Then do test your new Apache by browsing to your local web, making sure that you have (if you’re downloading the same version as mine) Apache version 2.2.11 running. You can do it by either having a PHP script that does phpinfo() or by using firebug to see the response header.

At this point, we have 3 out of 4 components of MAMP. Obviously, you have your Mac. Apache was just installed, and MySQL we’ve done on page 1. On the next page, I’ll discuss how to compile PHP on Mac OS X to replace the built-in PHP.

Pages: 1 2 3

One Response to “Rebuilding MAMP stack from scratch.”

  1. Gaurav Says:

    I get the mod_flvx.c end type:apxs -I /usr/local/include/apr-1/ -c -i ./mod_flvx.c (apr stay in /usr/local/include/apr-1/)System write me:cc -DLOGIN_CAP -funsigned-char -O2 -fno-strict-aliasing -pipe -DDOCUMENT_LOCATION= /usr/local/www/data -DDEFAULT_PATH= /bin:/usr/bin:/usr/local/bin -DHARD_SERVER_LIMIT=512 -fpic -DSHARED_MODULE -I/usr/local/include/apache -I/usr/local/include/apr-1/ -c ./mod_flvx.c./mod_flvx.c: In function drive_flvx’:./mod_flvx.c:81: wianrng: passing argument 4 of apr_stat’ from incompatible pointer type./mod_flvx.c:90: wianrng: passing argument 5 of apr_file_open’ from incompatible pointer type./mod_flvx.c:94: wianrng: passing argument 4 of ap_log_rerror’ makes pointer from integer without a cast./mod_flvx.c:94: wianrng: passing argument 5 of ap_log_rerror’ from incompatible pointer type./mod_flvx.c:110: error: conn_rec’ has no member named bucket_alloc’./mod_flvx.c:110: wianrng: passing argument 1 of apr_brigade_create’ from incompatible pointer type./mod_flvx.c:116: wianrng: passing argument 4 of ap_log_rerror’ makes pointer from integer without a cast./mod_flvx.c:116: wianrng: passing argument 5 of ap_log_rerror’ from incompatible pointer type./mod_flvx.c:121: wianrng: passing argument 5 of apr_brigade_insert_file’ from incompatible pointer type./mod_flvx.c:129: error: struct stat’ has no member named mtime’./mod_flvx.c:132: error: request_rec’ has no member named output_filters’./mod_flvx.c: In function flvx_handler’:./mod_flvx.c:142: error: AP_METHOD_BIT’ undeclared (first use in this function)./mod_flvx.c:142: error: (Each undeclared identifier is reported only once./mod_flvx.c:142: error: for each function it appears in.)./mod_flvx.c: In function register_hooks’:./mod_flvx.c:157: error: APR_HOOK_MIDDLE’ undeclared (first use in this function)./mod_flvx.c: At top level:./mod_flvx.c:160: error: expected =’, ,’, ;’, asm’ or __attribute__’ before flvx_module’apxs:Break: Command failed with rc=1OS freeBSD 7.0, Apache 1.3.41For Example, in header files *.h i can not find define AP_METHOD_BITCan you help me?

Leave a Reply

Time limit is exhausted. Please reload the CAPTCHA.