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

On my previous article, I’ve discussed two ways to enable PHP on your Mac. For most situation, one of those two solutions should be sufficient. There are times, however, that you need more features than the default and therefore need to customize one or more components of your MAMP stack.

For me, the need comes when I need PCNTL extension for my PHP-CLI scripts. Unfortunately, both of those solutions doesn’t have PHP with PCNTL support. So I’m forced to recompile PHP on either MAMP package or the built-in PHP.

My initial tendency is to not touch whatever built-in with Mac OS X as they may have upgrades later and the custom changes may conflict with the official update. It’s also possible that you inadvertently install the update that overwrite the custom changes you made. However, I could not find the original configuration parameters for MAMP package. Thus, I’m forced to update PHP built-in with Mac OS X.

So having quite lengthy introduction, which I feel is needed for you to understand the background reasoning of why I’m rebuilding MAMP stack by recompiling packages from scratch on Mac OS X 10.5 Leopard.

Prerequisites

Before continuing, you need to make sure XCode is installed. If you have the installation DVD, browse through optional install folder to find XCode. Alternatively, you can download XCode from Apple. You need to get a free apple developer membership to download from Apple. Install XCode with the default options and you should be fine.

Secondly, you need to be comfortable working with command line and understand the basics of compiling open source programs; those are to configure the source (usually ./configure), then to compile (by running make) it, then to install it (by running make install).

Configure script takes different options for each software. In general configure script will take –prefix option. This option specifies the location where the software will be installed. It also takes –help to list all options that can be set.

First, install MySQL

There are 2 ways to install MySQL on Mac OS X. You can download the appropriate package from MySQL download page, or you can compile MySQL from scratch. My tendency is to not compile MySQL from scratch as MySQL team usually does a very good job on their binaries. This time, however, I’d suggest for you to compile MySQL from scratch. For some reasons the binary version of MySQL doesn’t have enough file to compile PHP with MySQL support.

So for this time, download the source code. Here’s a cleaned-up copy of my session when compiling MySQL. If you want to follow my steps verbatim, follow this instruction to install wget for Mac OS X.

user:~ user$ mkdir compile
user:~ user$ cd compile
user:compile user$ wget http://dev.mysql.com/get/Downloads/MySQL-5.1/ \
> mysql-5.1.34.tar.gz/from/http://mysql.he.net/
user:compile user$ tar -zxvf mysql-5.1.34.tar.gz
user:compile user$ cd mysql-5.1.34
user:mysql-5.1.34 user$ ./configure --prefix=/usr/local/mysql
user:mysql-5.1.34 user$ make
user:mysql-5.1.34 user$ sudo make install

Notes on my session compiling MySQL on Mac OS X

  1. You can add more options to ./configure depending on what you need. Do pass –help to get all the options.
  2. On the last step when you’re installing, do provide your password if asked.
  3. The easiest way to make sure MySQL starts when your computer starts, you can dowload MySQL binary package and install MYSQLStartupItem.pkg. To save you from downloading the large binary, you can download it here. Once installed, then issue the following command to start MySQL:
    user:~ user$ sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
    

On the next page, we’ll discuss on how to compile and install default Apache that comes with Mac OS X.

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


× 4 = twenty four