How to enable PECL uploadprogress extention in MAMP

PECL and MAMP

26.07.2010: Updated and improved to make it compatible with MAMP ver. 1.9. If you are not a PECL auto make ninja, please resort to the manual build if PECL modules chapter, then it give you more fine grain control of the build process it self.

Uploadprogress or simply any PECL/PEAR module in MAMP

<

p>This howto will show you how to get those pesky PECL modules to compile in MAMP like uploadprogress or Xdebug. First a little Drupal background information. FileField and ImageField 3.0 for Drupal 6 released as one of many new features enables us to use the PHP extension uploadprogress that especially come in handy giving the user feedback of progress when uploading large files. Many OS X users are using MAMP to sandbox their development environment but compiling a PECL/PEAR module is not quite that easy in MAMP.

Content

Build uploadprogress in Leopard (version 10.5.x)
Build uploadprogress in Snow Leopard (version 10.6.x)
Manually build uploadprogress or any PECL extension out there.
Trouble shooting and links to prebuild modules and some word of warning.

When installing the Drupal module filefield-6.x-3.x you will in /admin/reports/status find a friendly warning telling you that the uploadprogress module is a nice addon.
Upload progress
Your server is capable of displaying file upload progress, but does not have the required libraries. It is recommended to install the PECL uploadprogress library (prefered) or to install APC.

As an early adopter I could not find any information on the web on how to compile and get a PECL PHP extension compiled and up and running under MAMP. After a day forth and back between pages I solved it, and decided to try and document is for other that are still struggling.

Leopard (10.5.x)

apple_mac_os_x_10.5_leopard_1024x768_1.jpg

  1. Install Xcode Tools from your Mac OS X DVD or download it from Apple Developer Connection
  2. Download the complete PHP source code from php.net into /Applications/MAMP/bin/php5.2
  3. Create an include directory in the the php5.2 directory.
  4. Unzip/tar the php source archive and move it to /Applications/MAMP/bin/php5.2/include
  5. Rename the php source directory to just php (so then it will look like /Applications/MAMP/bin/php5.2/include/php)
  6. In Terminal use the following commands to compile the extension:
    cd /Applications/MAMP/bin/php5.2/include/php
    ./configure
    cd /Applications/MAMP/bin/php5.2/bin

    In MAMP 1.9.x and newer (I guess) the utilities in this directory are not executable (probably is this a safety proaction) make all these files executable, either by using Finder or from shell with:

    sudo chmod a+x *

    All the files in the directory should now be executable and you are all set to compile the extension:
    sudo ./pecl i uploadprogress

  7. The result should be "Build process completed successfully". Now all you need is to move the newly compiled extension to the folder containing the existing PHP-extensions. On my system is it located at: /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20050922 it might be slightly different on your configuration.

    To help with finding the extensions directory, look at your phpinfo page from MAMP: Under "PHP Core" is the listing for "extension_dir" that will be the path you want to copy to. You can also use this same page to confirm that the extension is successfully enabled.

  8. Open the /Applications/MAMP/conf/php5.2/php.ini file and add extension=uploadprogress.so in the ; Extensions section.
  9. Restart MAMP and you should be all set.

To verify that the extension got successfully loaded by Apache, take a look in your phpinfo page from MAMP. Just search the page for "uploadprogress".
Screen shot 2009-09-20 at 13.40.22.png

You can also manually start PHP from your command shell and ask what extensions it loaded:/Applications/MAMP/bin/php5.2/bin/php -m

Snow Leopard (10.6.x)

snow-leopard1.jpg

    Testet and updated to work with:
  • MAMP 1.9
  • PHP 5.2.14
  • OS X 10.6.4
  • Xcode: 3.2.2

Snow Leopard is almost identical to Leopard (and should be). A lot of people had problem loading the module they compiled (read comments bellow) on Snow Leopard. Snow Leopard introduced proper 64 bit support and Xcode compiled the module in 64bits mode only though MAMP 1.8/1.9 is still a 32bit (i386) application and loading a 64bit extension into a 32bit application is doomed. This is what worked on my system:

  1. Install Xcode Tools from your Mac OS X DVD or download it from Apple Developer Connection
  2. Download PHP 5.2.x complete source code from php.net.
  3. Create an include directory in your MAMP php5.2 directory
    mkdir /Applications/MAMP/bin/php5.2/include
  4. Unzip/tar the php source archive into the newly created include directory and rename php-5.2.xx to php so your directory should read: /Applications/MAMP/bin/php5.2/include/php
  5. Then to:
    cd /Applications/MAMP/bin/php5.2/include/php
    ./configure
  6. Before starting to compile do we need to do some GCC environment definitions, so paste this into your terminal:
    MACOSX_DEPLOYMENT_TARGET=10.6
    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

  7. use the following commands to compile the extension:
    cd /Applications/MAMP/bin/php5.2/bin
    In MAMP 1.9.x and newer (I guess) the utilities in this directory are not executable (probably is this a safety proaction) make all these files executable, either by using Finder or from shell with:
    sudo chmod a+x *

    All the files in the directory should now be executable and you are all set to compile the extension:
    sudo ./pecl install uploadprogress
    The result of from this command could in the end of log file read something like:

    Build process completed successfully
    Installing '/usr/lib/php/extensions/no-debug-non-zts-20090626/uploadprogress.so'
    install ok: channel://pecl.php.net/uploadprogress-1.0.1
    configuration option "php_ini" is not set to php.ini location
    You should add "extension=uploadprogress.so" to php.ini

  8. If the build process completed successfully all you need is to copy the newly compiled extension to the folder containing the already existing MAMP PHP extension but where do you copy your newly compiled extension? To locate the directory look in your MAMP phpinfo page, search for "extension_dir" and you will find the path in used on your system or from command shell:
    grep "extension_dir =" /Applications/MAMP/conf/php5.2/php.ini<code>
    On my system was it located at /Applications/MAMP/bin/php5.2/lib/php/extensions/no-debug-non-zts-20060613/ it might be slightly different on your system, anyway on using my paths:
    <code>cp /usr/lib/php/extensions/no-debug-non-zts-20090626/uploadprogress.so /Applications/MAMP/bin/php5.2/lib/php/extensions/no-debug-non-zts-20060613/

  9. With the extension safely located in the correct directory it is time to enable it. Open MAMP php.ini file (NOT the system global php.ini file that belongs to OS X) located at:
    /Applications/MAMP/conf/php5.2/php.ini
    and add
    extension=uploadprogress.so
    to the "Dynamic Extensions" sectioni.
  10. Restart MAMP and you should be all set.

To verify that the extension got successfully loaded by Apache, take a look in your phpinfo page from MAMP. Just search the page for "uploadprogress".
Screen shot 2009-09-20 at 13.40.22.png

You can also manually start PHP from your command shell and ask what extensions it loaded: /Applications/MAMP/bin/php5.2/bin/php -m

Manually build your PECL extension

152833988_dcba4bacd9.jpg
http://www.flickr.com/photos/grrphoto/ / CC BY 2.0

    Testet and updated to work with:
  • MAMP 1.9
  • PHP 5.2.14
  • OS X 10.6.4
  • Xcode: 3.2.2

No you don't need to be a Ninja to manually build an PECL module it normally involve a few more steps building the extension and be be very handy on computers with multiple PHP installations then makes it easier to control how to make the build and from where to include stuff.

  1. Install Xcode Tools from your Mac OS X DVD or download it from Apple Developer Connection
  2. Download PHP 5.2.x complete source code from php.net.
  3. Create an include directory in your MAMP php5.2 directory
    mkdir /Applications/MAMP/bin/php5.2/include
  4. Unzip/tar the php source archive into the newly created include directory and rename php-5.2.xx to php so your directory path should read: /Applications/MAMP/bin/php5.2/include/php
  5. Then do:
    cd /Applications/MAMP/bin/php5.2/include/php
    ./configure
  6. Download the PECL extension (normally pecl download uploadprogress will do the trick) and unpack it to you favourite directory and set up the GCC environment definitions to make sure we also get a i386 (32bit) version of the extensions so go ahead and paste the following into your terminal:
    cd uploadprogress-version
    /Applications/MAMP/bin/php5.2/bin/phpize
    MACOSX_DEPLOYMENT_TARGET=10.6
    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
    ./configure --with-php-config=/Applications/MAMP/bin/php5.2/bin/php-config
    make
    make install

The compiled module should now get copied to the correct extension directory and all you need to do is to restart the Apache MAMP server.

Still not working or are you just lazy?

3318930880_5344b6af33.jpg
http://www.flickr.com/photos/markjsebastian/ / CC BY-SA 2.0

If all of the above fails, read the instruction again and try to understand the steps, follow the carefully and keep a eye out for errors when MAMP is starting Apache. Monitor /Applications/MAMP/logs/php_error.log with Apple Console utility or from shell:
tail -f /Applications/MAMP/logs/php_error.log
You can also try loading more information regarding the extension manually:
/Applications/MAMP/bin/php5.2/bin/php --ri uploadprogress
This should give you something like:
uploadprogress
uploadprogress support => enabled
Version => 1.0.1
Directive => Local Value => Master Value
uploadprogress.file.filename_template => /var/tmp//upt_%s.txt => /var/tmp//upt_%s.txt
uploadprogress.file.contents_template => /var/tmp//upload_contents_%s => /var/tmp//upload_contents_%s
uploadprogress.get_contents => 0 => 0

A lot of the problem people are seeing trying to compile on Snow Leopard is related to PECL auto build are not correctly set up, and the pecl utility are building the extension by using the system wide PHP installation and/or the extension are build for 64bit programs only. MAMP (up to 1.9) are still running in 32 bit mode so loading a 64 bit version of your module in a 32 bits MAMP is futile. Check the compiled module:

file uploadprogress.so
uploadprogress.so: Mach-O universal binary with 2 architectures
uploadprogress.so (for architecture i386): Mach-O bundle i386
uploadprogress.so (for architecture x86_64): Mach-O 64-bit bundle x86_64

Does this this command tell you that it is only build for Mach-O 64-bit bundle x86_64 do you have an error in your PECL/PEAR config. Check for .pecl.default config files in your system that might cause you grief.

Still reading? Then I guess you are getting quite desperate, but not all hope is not lost. I have also provided two precompiled extensions:

  1. uploadprogress.so version 1.0.0 The extension is tested in MAMP 1.7.1, 1.7.2, 1.8.x under OS X version 10.5.x and 10.6.x.
  2. uploadprogress.so version 1.0.1 The extension is tested in MAMP 1.8.x and 1.9 under OS X version 10.6.x.

As usual you need to include the module in php.ini belonging to MAMP and restart the MAMP Apache server

Heads up if you have macports installed

Just a heads up...one thing that can cause headaches is if you have macports libraries installed that you have to link against....on Snow leopard if you don't edit /opt/local/etc/macports/macports.conf and uncomment this line build_arch i386 before you install the port it will compile using x86_64 architecture.....

Then when you try to build your extension (fileinfo in my case which needs libmagic installed) and point the config to look in /opt/local/ , if you are targeting 32 bit the build will crap out, and if you build in 64 bit obviously and you are downloading a precompiled version of 32 bit MAMP, then the extension won't load....anyhoo, I spose you could build MAMP from source in 64 bit as the other alternative.

Credits

This how to is largely build upon http://www.lullabot.com/about/nate-haug excellent article on how to Setup a Memcached-Enabled MAMP Sandbox Environment

Comments

Just what I was looking for! But step 7 seems incomplete, right?

Good catch! Step 7 is now fixed.

Once the extension is compiled and moved into MAMP's own extension's directory, does the extra downloaded copy of PHP need to remain, or can it be deleted? Thanks for the lesson by the way, I was wondering about how to do this in MAMP.

Thanks a lot, works like a charm!!

Hi! Once I get to "./pecl i uploadprogress" I get this error message: <code> No releases available for package "pecl.php.net/uploadprogress" Cannot initialize 'channel://pecl.php.net/uploadprogress', invalid or missing package file Package "channel://pecl.php.net/uploadprogress" is not valid install failed </code> I think the link is incorrect, because it should be: http://pecl.php.net/get/uploadprogress Help anyone? thanks! bluestar

Did you run: "./pecl i uploadprogress"

FYI I found that I didn't need to install the complete PHP Source Code into MAMP. Once I downloaded xCode Tools I was fine.

Thanks for the guild but I couldn't get a success installation. I get the error below: uploadprogress.c:75: error: 'MULTIPART_EVENT_START' undeclared (first use in this function) /Users/jenoloo/temp/uploadprogress/uploadprogress.c:75: error: (Each undeclared identifier is reported only once /Users/jenoloo/temp/uploadprogress/uploadprogress.c:75: error: for each function it appears in.) /Users/jenoloo/temp/uploadprogress/uploadprogress.c:76: error: 'multipart_event_start' undeclared (first use in this function) /Users/jenoloo/temp/uploadprogress/uploadprogress.c:76: error: 'e_data' undeclared (first use in this function) /Users/jenoloo/temp/uploadprogress/uploadprogress.c:77: error: parse error before ')' token /Users/jenoloo/temp/uploadprogress/uploadprogress.c:87: error: 'MULTIPART_EVENT_FORMDATA' undeclared (first use in this function) /Users/jenoloo/temp/uploadprogress/uploadprogress.c:89: error: 'multipart_event_formdata' undeclared (first use in this function) /Users/jenoloo/temp/uploadprogress/uploadprogress.c:90: error: parse error before ')' token /Users/jenoloo/temp/uploadprogress/uploadprogress.c:124: error: 'MULTIPART_EVENT_FILE_START' undeclared (first use in this function) /Users/jenoloo/temp/uploadprogress/uploadprogress.c:127: error: 'multipart_event_file_start' undeclared (first use in this function) /Users/jenoloo/temp/uploadprogress/uploadprogress.c:129: error: parse error before ')' token /Users/jenoloo/temp/uploadprogress/uploadprogress.c:146: error: 'MULTIPART_EVENT_FILE_DATA' undeclared (first use in this function) /Users/jenoloo/temp/uploadprogress/uploadprogress.c:147: error: 'multipart_event_file_data' undeclared (first use in this function) /Users/jenoloo/temp/uploadprogress/uploadprogress.c:149: error: parse error before ')' token /Users/jenoloo/temp/uploadprogress/uploadprogress.c:163: error: 'MULTIPART_EVENT_FILE_END' undeclared (first use in this function) /Users/jenoloo/temp/uploadprogress/uploadprogress.c:164: error: 'multipart_event_file_end' undeclared (first use in this function) /Users/jenoloo/temp/uploadprogress/uploadprogress.c:166: error: parse error before ')' token /Users/jenoloo/temp/uploadprogress/uploadprogress.c:176: error: 'MULTIPART_EVENT_END' undeclared (first use in this function) make: *** [uploadprogress.lo] Error 1 ERROR: `make' failed Thanks

What version of OS X are you running? What PHP version did you download? It is not finding any or some lib from PHP when it compiles the plugin.

I am running on my test machine which is my laptop running Mac OS X 10.4.10. + drupal 6.12 + MAMP Pro 1.7.2 (I think it won't make any difference if I am using the free version of MAMP). Thanks

PHP Version 5.2.6

I think the problem is that you are running ver. 10.4 (not 100% sure) You could test it by manually downloading the extension and unpack it (anywhere). then run: <cite>phpize</cite> (This makes the "build files". If that worked) <cite>./configure</cite> <cite>make</cite> phpize is a part of the system wide installed PHP and it is prob. to old release: Try "whereis phpize" and the shell will tell you what location. This is from my OS X ver. 10.5.6: "phpize --version" Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519 "php -v" PHP 5.2.8 (cli) (built: Feb 5 2009 21:21:13) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

HI Thanks for this. I finished up to the end of the terminal bit, got the "Build process completed successfully" but I'm confused about which file needs to be moved where? Should there be a new file created in the newly created 'include' directory that I need to move? Thanks

The compilation create an extension named uploadprogress.so. This is the file you need to move.

Well done, thanks. To help with finding the extensions directory, look at your phpinfo page from MAMP: Under "PHP Core" is the listing for "extension_dir" that will be the path you want to copy to. You can also use this same page to confirm that the extension is successfully enabled.

That is a great tip Kyle, I'll add this information about how to find your extension_dir to the how to. Thanx!

Many thanks! works great!!

Thanks for the instructions... I tried to compile and install uploadprogress following the instructions above, and it looks like everything went well, but the extension does not seem to be enabled. I am on OS X 10.6 running mamp v. 1.8.1 with php 5.2.10. I added the appropriate line to php.ini and made the uploadprogress.so file was executable. Am I missing something or are there any known conflicts I should look out for? .... Build process completed successfully Installing '/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/uploadprogress.so' install ok: channel://pecl.php.net/uploadprogress-1.0.1 configuration option "php_ini" is not set to php.ini location You should add "extension=uploadprogress.so" to php.ini ...

I'm running MAMP v.1.7.2 on OS 10.5.8 & using PHP Version 5.2.6. When I try "php --ri uploadprogress" I get: PHP Warning: PHP Startup: uploadprogress: Unable to initialize module <strong>Module compiled with module API=20090626</strong>, debug=0, thread-safety=0 <strong>PHP compiled with module API=20060613</strong>, debug=0, thread-safety=0 <strong>These options need to match</strong> in Unknown on line 0 Extension 'uploadprogress' not present.

Could be a bug with ver 1.0.1. I'll try and do some tests and post back my results, interesting....

I've tried twice now to follow these instructions, but without success. I tried once with my original install of MAMP. Everything completed successfully, I moved the uploadprogress.so into the correct folder and changed the PHP.ini. Still didn't work. So, just in case I screwed up, I re-installed the latest version of MAMP, downloaded the latest version of PHP, and followed the steps. Again, no error messages, but I can't find uploadprogress on the PHPinfo page and my Drupal site still indicates that it's not installed. Any idea? Where exactly should I check on the PHPinfo page for evidence that it's actually installed. Thanks for the tutorial.

I have done some more tests on a MAMP ver 1.7.1 setup under 10.6.x. This computer is upgraded from 10.5.x with an existing working MAMP env. phpize Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626 Compiled successfully uploadprgress ver 1.0.1 with GCC ver. 4.2.1 (current running XCode release), but MAM/Apache is not able to load it. Did the same ting with uploadprgress 1.0.0 that also have problem loading under 10.6..

Have done some more debugging and I think the problem is that PHP is compiled in 32 bit mode, but when you compile on 10.6 modules by default get compiled in 64 bit mode: file uploadprogress.so uploadprogress.so: Mach-O 64-bit bundle x86_64 Get compiled GCC in 10.6.x uploadprogress.so uploadprogress.so: Mach-O bundle i386 Compiled in 10.5.x and are working. I have uploaded a <a href="/sites/smbjorklund.no/files/uploadprogress.so">precompiled uploadprogress.so</a> to try and help you out until we have solved this problem. The extension is tested and is working in MAMP 1.7.1, 1.7.2, 1.8.x under OS X ver. 10.5.x and 10.6.x.

Dear Friends I've this error in SNOW LEOPARD (after section 6 of this tutorial) sh-3.2# ./configure creating cache ./config.cache checking for Cygwin environment... no checking for mingw32 environment... no checking for egrep... grep -E checking for a sed that does not truncate output... /usr/bin/sed checking host system type... i686-apple-darwin10.0.0 checking target system type... i686-apple-darwin10.0.0 checking for gcc... no checking for cc... no configure: error: no acceptable cc found in $PATH sh-3.2# cd /Applications/MAMP/bin/php5/bin sh-3.2# ./pecl i uploadprogress WARNING: channel "pecl.php.net" has updated its protocols, use "channel-update pecl.php.net" to update downloading uploadprogress-1.0.1.tgz ... Starting to download uploadprogress-1.0.1.tgz (8,536 bytes) .....done: 8,536 bytes 4 source files, building running: phpize Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626 Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script. ERROR: `phpize' failed sh-3.2# ERROR: `phpize' failed And IF I try this: sh-3.2# phpize Cannot find config.m4. Make sure that you run '/usr/bin/phpize' in the top level source directory of the module Why It not work?

Well I've try to download the precompiled uploadprogress.so from here: http://smbjorklund.no/sites/smbjorklund.no/files/uploadprogress.so I've put it on my /Application/MAMP/bin/php5/lib/php/extension/no-debug-non-zts-20050922 And I've restart MAMP but It not work, WHY??? Somebody help me please?

@ryosaeb4 You must have done something wrong prior to point 6. Autoconf is part of Xcode check if it is installed by <code>ls -l /Developer/usr/bin/autoconf</code> If you are trying manually to build the extension make sure you run the phpize that is a part of MAMP (/Applications/MAMP/bin/php5/bin/phpize), OS X also ship with phpize and make sure you are in the top level dir of the module source code. Remember to include the extension in your MAMP php.ini file and look for problems inside your /Applications/MAMP/logs/php_error.log

Just in case you guys have not noticed it, I solved the issue regarding making this work in Snow Leopard few days ago and updated this article. I also added a section about manually compiling en PECL extension. Cheers Steinmb

Thanks! Saved my day. :)

Thanks for the pre-compiled extension. Saved me lots of time. :D

Hi I thank for this article on PECL uploadprogress for MAMP this helped to do that. I got same warning and I deleted and installed MAMP many times did same but again I got same PHP Warning: PHP Startup: uploadprogress: Unable to initialize module Module compiled with module API=20090626, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0 But I later found that my MAMP php version is 5.2.11 and I was downloading php 3.0 stuff and following same method and failing. LOL then I saw a little below downloaded tar.gz for php 5.2.11 and now all is well... I am posting this if any did same like me and didn't observe error they are doing may be getting frustrated like me LOL... well done in this article thanks again

Glad so many found this article useful. There is a lot of pitfalls out there ;)

on 10.6 system present system php 5.3 and mamp php 5.2.* when I try to compile for mamp it compile for system php 5.3 how to say in console, php to compile with mamp php.ini?

@Andre: That is correct, that is the reason you need to follow the Snow Tiger section in this how to and hopfully you will have not have any problems.

ok by comand /mamp-path/php -m uploadprogress loaded I restart MAMP but phpinfo show that uploadprogress not loaded

@andre: Getting close now :) Check your MAMP php.ini file, you must be missing something there.

close.. ? in phpinfo Configuration File (php.ini) Path /Applications/MAMP/conf/php5 NEXT file is new after mamp reboot. Loaded Configuration File /Library/Application Support/appsolute/MAMP PRO/conf/php.ini file /Applications/MAMP/conf/php5/php.ini not printed in that table. where is original data for /Library/Application Support/appsolute/MAMP PRO/conf/php.ini ? (

Have never used MAMP pro. Check your php_info() setting, It will tell you what php.ini that is in use.

thanks a lot ! mamp pro autocreate ini-files from templates (File-Edit Templates) do not forget to copy *.so files to right place.

Thanks A lot! You gave the info I needed in a clean simple manner that even a noob like me could understand.

Thanks a lot, that snippet was impossible to figure out ! <code> MACOSX_DEPLOYMENT_TARGET=10.6CFLAGS="-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 </code>

Just a heads up...one thing that can cause headaches is if you have macports libraries installed that you have to link against....on Snow leopard if you don't edit /opt/local/etc/macports/macports.conf and uncomment this line build_arch i386 before you install the port it will compile using x86_64 architecture..... Then when you try to build your extension (fileinfo in my case which needs libmagic installed) and point the config to look in /opt/local/ , if you are targeting 32 bit the build will crap out, and if you build in 64 bit obviously and you are downloading a precompiled version of 32 bit MAMP, then the extension won't load....anyhoo, I spose you could build MAMP from source in 64 bit as the other alternative.

Thanx @jon! I have included you tip in the how to. If you have not shared this information with with us I would never have known :)

you're a champion! I could not get it load, tried it all. Finally downloaded your pre-complied .so and it work perfectly! I must have screwed up the compile somewhere. Thank you!

Thank god for your precompiled so! I get my server done but i never get my laptop done, i get stuck on this problem for two days already! Thanks so much, you are my angel.

Thank you for this! I have used it to try to install oauth.so. I followed the instructions, suitably amended, and oauth.so is in the right place and the extensions line in php.ini is correct. However, I get the following error when I restart mamp: [26-Feb-2010 15:05:35] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/oauth.so' - (null) in Unknown on line 0 What did I do wrong? Rob

Hi Rob Have no idea what the problem is regarding http://pecl.php.net/package/oauth You could try to follow the manual compile instruction in the how to.

Thanks for this useful post~ I will be trying it tonight!

Hi, I'm trying to install pecl_http with your instruction, but I get stuck at the "./configure", when I get the answer: -bash: ./configure: No such file or directory Obviously, after that pecl i pecl_http starts but it fails in the end... Do you have any suggestion? Thanks Danilo

Hi Danilo Make sure that you complete step 1-5 before starting the ./configure script.

Hi, I'm using MAMP 1.9 on OS X 10.6.3. MAMP 1.9 is using php 5.3.2 Extensions folder is located on /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/ I've downloaded your pre-compiled file (1.0.1) and copied into this folder, then edited php.ini: <code> ; Extensions extension=apc.so extension=imap.so extension=yaz.so extension=mcrypt.so extension=gettext.so extension=pgsql.so extension=pdo_pgsql.so extension=pdo_mysql.so extension=uploadprogress.so </code> I've restarted MAMP servers, but the extension doesn't load. Any advice?

Pages