I had a previous article that discussed in detail on how to get imagick php plugin working on MAMP. As always, as you get more exposed to technologies and frameworks you find new ways to do things. One thing to keep in mind with MAMP is that 1.8.4 is still 32-bit build. Once it goes 64-bit, I am sure the whole thing will get easier.
In this instance, I was working through adding UUID generation support to my PHP code. While the uniqid provides a function to generate IDs, it is not a GUID specification. There is PECL UUID module that provides “a wrapper around libuuid from the ext2utils project”. After looking around for how to add it to MAMP, I came across the following article that talked about how to enable the uploadprogress module. utilizing the same process I attempted to build the uuid module. Unfortunately, the uuid module failed to compile. This eventually lead to a defect report for the uuid module about Mac OS X and older version of files. Attached was a patch file; patched the files and remade. Installed, reloaded and all was good.
The following are the steps I used for the installation of uuid module.
Download and extract the uuid module
Grabbed the 1.2 version of the uuid module.
macbook:Downloads mleo$ wget http://pecl.php.net/get/uuid-1.0.2.tgz
mabook:Downloads mleo$ tar -xzf uuid-1.0.2.tgz
macbook:Downloads mleo$ cd uuid-1.0.2
Get & Apply Patch
Copy patch code from here. Save the contents into mac.patch file. Apply patch. It did require entry of the path to two test files during the patch process.
macbook:uuid-1.0.2 mleo$ patch < mac.patch patching file config.m4 patching file php_uuid.h can't find file to patch at input line 103 Perhaps you should have used the -p or --strip option? The text leading up to this was: -------------------------- |diff -urp uuid-1.0.2/tests/uuid_mac.phpt uuid- |1.0.2.mine/tests/uuid_mac.phpt |--- tests/uuid_mac.phpt 2008-04-01 08:59:22.000000000 -0700 |+++ tests/uuid_mac.phpt 2008-08-14 10:21:57.000000000 -0700 -------------------------- File to patch: tests/uuid_mac.phpt patching file tests/uuid_mac.phpt can't find file to patch at input line 116 Perhaps you should have used the -p or --strip option? The text leading up to this was: -------------------------- |diff -urp uuid-1.0.2/tests/uuid_time.phpt uuid- |1.0.2.mine/tests/uuid_time.phpt |--- tests/uuid_time.phpt 2008-04-01 08:59:22.000000000 -0700 |+++ tests/uuid_time.phpt 2008-08-14 10:22:50.000000000 -0700 -------------------------- File to patch: tests/uuid_time.phpt patching file tests/uuid_time.phpt patching file uuid.c
Configure and Build the Module
I'll leave the prompts out of this one to make it easier to copy and paste the set of commands, but each line in the below code block is different command.
CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp"
CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"
CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"
LDFLAGS="-arch i386 -arch x86_64 -bind_at_load"
export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET
Add module to php.ini
Edit the /Applications/MAMP/conf/php5/php.ini file and add "extension=uuid.so".
Can check info to see if uuid module loads and run the uuid_create() function to see if it returns.
macbook:uuid-1.0.2 mleo$ /Applications/MAMP/bin/php5/bin/php -r 'print phpinfo();'
Version => 1.0.2 (stable)
Released => 2008-04-01
CVS Revision => $Id: uuid.c,v 1.9 2008/04/01 15:58:52 hholzgra Exp $
Authors => Hartmut Holzgraefe 'email@example.com' (lead)
macbook:uuid-1.0.2 mleo$ /Applications/MAMP/bin/php5/bin/php -r 'print uuid_create() . "\n";'