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

Alright … Finally, we’re at the last stage of rebuilding our MAMP stack by compiling each components from scratch. Le’s discuss how we compile PHP on Mac OS X then.

Compiling PHP on Mac OS X

Like I said on the first page, I’m actually happy with Mac OS X default PHP options. The only thing that doesn’t work for me is that they don’t have support for PCNTL. My goal was to add PCNTL function on top of existing PHP. That means, I have to find out what the original config options are and adding –enable-pcntl. To find out PHP’s original configuration options, you can either do phpinfo() on web and find the configure command, or you can run command line PHP and pass -i to it. I opted to do the command line option.

user:compile user$ php -i > php_info_orig
user:compile user$ 

Here’s my original PHP Configure Command. My PHP version was 5.2.6.

Configure Command =>
   '/SourceCache/apache_mod_php/apache_mod_php-44.1/php/configure'
      '--prefix=/usr'
      '--mandir=/usr/share/man'
      '--infodir=/usr/share/info'
      '--disable-dependency-tracking'
      '--with-apxs2=/usr/sbin/apxs'
      '--with-ldap=/usr'
      '--with-kerberos=/usr'
      '--enable-cli'
      '--with-zlib-dir=/usr'
      '--enable-trans-sid'
      '--with-xml'
      '--enable-exif'
      '--enable-ftp'
      '--enable-mbstring'
      '--enable-mbregex'
      '--enable-dbx'
      '--enable-sockets'
      '--with-iodbc=/usr'
      '--with-curl=/usr'
      '--with-config-file-path=/etc'
      '--sysconfdir=/private/etc'
      '--with-mysql-sock=/var/mysql'
      '--with-mysqli=/usr/bin/mysql_config'
      '--with-mysql=/usr'
      '--with-openssl'
      '--with-xmlrpc'
      '--with-xsl=/usr'
      '--without-pear'

If you remeber back in page 1, we’ve installed MySQL on /usr/local/mysql. So there are a few changes you need to do on the config option, namely, changing MySQL path to /usr/local/mysql. I also removed –with-mysql-sock option. Below is my abbreviated session on compiling PHP on Mac OS X.

user:compile user$ wget \
> http://us3.php.net/get/php-5.2.9.tar.gz/from/us2.php.net/mirror
user:compile user$ tar -zxvf php-5.2.9.tar.gz
user:compile user$ cd php-5.2.9
user:php-5.2.9 user$ ./configure --prefix=/usr --mandir=/usr/share/man \
> --infodir=/usr/share/info --disable-dependency-tracking \
> --with-apxs2=/usr/sbin/apxs --with-ldap=/usr --with-kerberos=/usr \
> --enable-cli --with-zlib-dir=/usr --enable-trans-sid --with-xml \
> --enable-exif --enable-ftp --enable-mbstring --enable-mbregex \
> --enable-dbx --enable-sockets --with-iodbc=/usr --with-curl=/usr \
> --with-config-file-path=/etc --sysconfdir=/private/etc \
> --with-mysqli=/usr/local/mysql/bin/mysql_config \
> --with-mysql=/usr/local/mysql --with-openssl --with-xmlrpc \
> --with-xsl=/usr --without-pear --enable-pcntl
user:php-5.2.9 user$ make
user:php-5.2.9 user$ sudo make install
user:php-5.2.9 user$ 

Notes on my session compiling PHP on Mac OS X

  1. If you got error like “configure: error: mysql configure failed. Please check config.log for more information.”, you probably have MySQL binary installed, instead of compiling MySQL from scratch. I’m not sure which files / libraries / headers are missing from the binary install. If you’re facing errors like this, then my only suggestion is to compile MySQL and install it to some temporary place and compile PHP and refer MySQL to that temporary place.
  2. Like the other components of MAMP, you can pass additional options to configure command. Add / customize yours as you see fit.
  3. Once it is installed, restart Apache (refer to page 2 on how to do it) and check your phpinfo() script. It should now say PHP 5.2.9.
  4. Optionaly, you can also do PHP cli and pass -i to it. You should also see PHP 5.2.9 on the command line option.

That’s it. I hope this article is of any help to anyone. And as always, I welcome comments / suggestions / questions. I’m looking forward to improving my solution with your comments / suggestions / questions.

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.