Plugging mcrypt into PHP, on Mac OS X Lion 10.7

Perfected for the winter cat, now on to the king of the jungle. Once again, thanks goes out to a previous commenter, this time it’s rachanta, for the first test. Now let’s get moving…

The following instructions cater to those who a) are developing on OS X Lion 10.7.X, b) need the capabilities provided by mcrypt during their PHP development, and c) do not want to completely recompile PHP to get there. You’ll get mcrypt loading dynamically for use in PHP with this method.

First, you are going to need a few things…

1) libmcrypt-2.5.8, which you can pick up here; NOTE: make sure to get libmcrypt and not mcrypt.

2) PHP 5.3.6 source, which you grab here; ADDITIONAL NOTE: You may update your OS X at some point, and PHP may get updated along with it. Use phpinfo() to check your version of PHP, and then download the PHP source for that version.

and

3) Xcode 4.1 tools, which you can pick up in the App Store.

Next, create a directory at root called ‘SourceCache’ and dump the files from #1 and #2 in there and unwrap.

Move to the libmcrypt-2.5.8 directory, and punch in this…

MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --disable-dependency-tracking

and then…

make -j6

and finally…

sudo make install

libmcrypt is ready – now for the PHP extension…

Move back to /SourceCache, then down to php-5.3.6/ext/mcrypt – type…

/usr/bin/phpize (phpize should be in /usr/bin – if not go find it and change the command as appropriate)

Then configure as follows…

MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config

Again: make -j6 then sudo make install

Make sure you have php.ini in the /etc directory – it will probably be php.ini.default to start, particularly if you’ve just done an OS X upgrade or a clean Lion install, so rename it. Ensure that enable_dl = On but do not remove the ; from in front of ;extension_dir = "./". Add one line to the .ini file in the Dynamic Extensions section… extension=mcrypt.so

Restart Apache – you should be all set (again), according to phpinfo():

PHP OS X Lion

mcrypt PHP OS X Lion

MG signing off (now that we have mcrypt running in PHP once again)

Comments

  1. says

    Just upgraded to Lion and my dev environment got smashed to pieces! Worked perfectly for me, after spending far too long working out that installing Xcode through the App Store doesn’t actually install Xcode. You have to run ‘Install Xcode’ that appears in you Applications after the App Store has finished.

  2. says

    Thanks! Helped a lot.

    I’d add to this list upgrading to Xcode 4.1 before any step. Took me a while to realize my old install of Xcode 4.0 on Lion was causing the make command to fail.

  3. says

    Mcrypt was the final piece in the puzzle of upgrading my dev environment to Lion. (cross fingers) Thanks for working through this and getting a solution posted so quickly.

  4. Sam Parmenter says

    Cheers buddy, nice guide and easy to follow. As others have said; final piece of the puzzle since a clean install of lion!

  5. slypix says

    I ran every step, it looked like it installed the extension, added it to my php.ini, but still doesn’t load, I did it on a fresh install of lion, is there anyway to debug or pinpoint the problem?

    thanks.

    • says

      I’d start by checking every step, one after the other. Often people miss something simple, like enabling dynamic loading in php.ini.

      Or they started with the wrong version of Xcode and/or typed a command wrong, assuming everything went accordingly because they saw a bunch of text fly by while in Terminal. Are the libraries compiling correctly? Is mcrypt.so in /usr/lib/php/extensions/no-debug-non-zts-20090626/ ?

      • slypix says

        first off, thanks for the tutorial and quick reply.

        I agree I don’t understand all the text flying by, after the compile command, make, and make install…. I did start with xcode 4.1 just downloaded yesterday, I copy and pasted the long commands. enabled dynamic loading in php.ini (enable_dl = On) and added (extension=mcrypt.so) to the dynamic library section.

        I also checked if (mcrypt.so) was in “/usr/lib/php/extensions/no-debug-non-zts-20090626/”, indeed it is.

        restarted mysql and apache… and still not loading. I’m clueless. Is there an error log I can look at to help pinpoint the trouble?

        thanks again.

          • slypix says

            I was hoping to see mentions of mcrypt in the error_log, but no mention of it.

            ya phpinfo() doesn’t list mcrypt, the reason I restarted MySQL, is because I’m trying to get phpMyAdmin to work, and it requires the mcrypt extension.

          • slypix says

            I decided to start from scratch, re-formated, did a clean install of lion, enabled PHP, installed mcrypt using your instructions and worked flawlessly, I then ran migration assistant, and restored all my data and apps using time machine.

            it took a total of 4 hours, but totally worth it, because I’m sure I would have wasted countless hours over many night, trying to find the problem.

            thanks for the tutorial.

  6. says

    @slypix – Best I can suggest is to 1) forget about phpMyAdmin/MySQL for now (again, it has nothing to do with this), then 2) delete the source files and start over.

    I’m not suggesting anything you are doing on the side is causing the problem, but unfortunately there is no other way to troubleshoot from afar since the process outlined above is proven if followed to the “T”.

  7. ralen76 says

    Hello MG, I`m trying to follow your instructions but I`m getting an error at this point:

    Then configure as follows…

    MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ ./configure –with-php-config=/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config

    The exact error I’m receiving is:


    checking for grep that handles long lines and -e… /usr/bin/grep
    checking for egrep… /usr/bin/grep -E
    checking for a sed that does not truncate output… /usr/bin/sed
    checking for cc… cc
    checking for C compiler default output file name… a.out
    checking whether the C compiler works… yes
    checking whether we are cross compiling… no
    checking for suffix of executables…
    checking for suffix of object files… o
    checking whether we are using the GNU C compiler… yes
    checking whether cc accepts -g… yes
    checking for cc option to accept ISO C89… none needed
    checking how to run the C preprocessor… cc -E
    checking for icc… no
    checking for suncc… no
    checking whether cc understands -c and -o together… yes
    checking for system library directory… lib
    checking if compiler supports -R… no
    checking if compiler supports -Wl,-rpath,… yes
    checking build system type… i386-apple-darwin11.0.0
    checking host system type… i386-apple-darwin11.0.0
    checking target system type… i386-apple-darwin11.0.0
    checking for PHP prefix… /usr
    checking for PHP includes… -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
    checking for PHP extension directory… /usr/lib/php/extensions/no-debug-non-zts-20090626
    checking for PHP installed headers prefix… /usr/include/php
    checking if debug is enabled… no
    checking if zts is enabled… no
    checking for re2c… no
    configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
    checking for gawk… no
    checking for nawk… no
    checking for awk… awk
    checking if awk is broken… no
    checking for mcrypt support… yes, shared
    checking for libmcrypt version… >= 2.5.6
    checking for mcrypt_module_open in -lmcrypt… no
    checking for mcrypt_module_open in -lmcrypt… no
    configure: error: Sorry, I was not able to diagnose which libmcrypt version you have installed.

    I`ve recently update my os from Snow Leopard (with all this stuff working properly) to Lion.
    Can you please tell me what I’m doing wrong

    Thanks beforehand.

      • ralen76 says

        No, I don´t think so. Is there a way to check it?
        I suppose that I just activated PHP version that came with Snow Leopard …
        I have MySql running OK but not the same with phpMyadmin (which shows me the mcrypt load error). And of course, mcrypt section doesn´t appear into the phpinfo() list.

      • ralen76 says

        I´m sorry, I misunderstood your replay. I mean, I follow your guide from the top, but receive the error at the mentioned point.

          • ralen76 says

            Thank you Michael, I´ve tried to solve installing libtool and repeating your lines, but unfortunately this has not fixed the issue, same error at the same point. The good new is that I´m sucessfully working with Zend Server CE; at the moment the best solution for me.
            I´m sure I´m coming back here soon with a fresh clean installation of Lion, maybe in a few weeks.

            Thanks for everything, mate.

    • yellow shark says

      Check why configure fails:
      /usr/local/lib/libmcrypt.dylib is a i386 only library in my case.

      Start fresh & clean – and do only the 64bit version-
      For libmcrypt:
      make clean
      then configure again
      MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O3 -fno-common -arch x86_64' LDFLAGS='-O3 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch x86_64' ./configure --disable-dependency-tracking
      then make -j6; sudo make install; make check

      Now we have a 64bit version of dylib – and that’s expected in the next step for php.
      Go back to php-5.3.6/ext/mcrypt and continue with phpize

  8. says

    Hello,

    I’ve got an odd situation in which I’ve followed these instructions on two different Macs after upgrading from Snow Leopard to Lion. Everything worked perfectly the first time, on the first Mac, and it did seem to work on the second, but the second does not have mcrypt installed after restarting Apache.

    I see in one of the comments above that you ask if mcrypt.so is in “/usr/lib/php/extensions/no-debug-non-zts-20090626/” – for me, it’s not. I tried redownloading the code for libmcrypt, and recompiling it, but this didn’t seem to change anything.

    Any steps I can take to get mcrypt into the right place?

    Thanks!

    • says

      “I tried redownloading the code for libmcrypt, and recompiling it, but this didn’t seem to change anything.”

      mcrypt.so is the dynamic module created during the second wave of compilation. You have to complete all of the steps from start to finish – can’t start or end midstream with any expectation of success.

      When in doubt, delete source and start from scratch – that has solved the majority of problems with this procedure since the Leopard days.

        • says

          Nope. It’s just that sometimes people surmise their problem is with one piece of the puzzle, whereas when I recommend restarting I really mean back to the very beginning.

  9. Richard Warner says

    Move back to /SourceCache, then down to php-5.3.6/ext/mcrypt – type…
    /usr/bin/phpize (phpize should be in /usr/bin – if not go find it and change the command as appropriate)

    OK I’m lost at this bit where exactly am i running the command from. When in php-5.3.6/ext/mcrypt if I type /usr/bin/phpize i get a file not found message but I would assume that if running inside phpphp-5.3.6/ext/mcrypt.

    and in what directory do i run the second MACOSX_DEPLOYMENT_TARGET=10.7 command in the php-5.3.6 or the phpphp-5.3.6/ext/mcrypt as it fails with a configure not found.

    • says

      You are running the command “/usr/bin/phpize” from the directory suggested, php-5.3.6/ext/mcrypt. If phpize is not in /usr/bin then you need to find out where it is and modify the command.

      The second compilation won’t work until you do the above correctly.

  10. says

    Thanks for this, but also have the configure: error: Sorry, I was not able to diagnose which libmcrypt version you have installed. issue

    Made this change after looking 10.5 and 10.6 libmcrypt .configure (see -bindatload):
    MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64 -bindatload' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --disable-dependency-tracking

    WARNING !!!:
    I have no idea of what -bindatload means, but it compile fine, the PHP extension too and phpinfo() said mcrypt is enabled.

    hth

  11. Ben says

    Thanks, this was very helpful!

    If someone has time, could they explain the MACOSX_DEPLOYMENT … lines in a bit more detail?

  12. appsfinder says

    got this working on lion did not need to reinstall lion
    by adding to php.ini

    ; Extensions
    extension=mcrypt.so

    ;;;;;;;;;;;;;;;;;;;
    ; Module Settings ;
    ;;;;;;;;;;;;;;;;;;;

  13. David says

    Are any of you running Lion server who have done this install? I am and my php.ini file is in /private/etc/ and my httpd.conf is in /private/etc/apache2. It looks like either Lion server created this new directory or Lion did when I upgraded from Snow Leopard. How/if would this impact the procedure you outline above? I also need to get the mcrypt library installed to run my development web site.

    Thanks!

  14. Peter says

    I can’t find a directory called php-5.3.6 on my Mac even though when I run phpinfo.php I get all of the information showing that php-5.3.6 is loaded. Where would it be?

    Should I just go to the PHP website and download php-5.3.8?

    Thanks,

    Peter

  15. jason says

    i know these comments are pointless, but i just wanted to say thanks (again!). you have saved people countless hours.

    • says

      Which is precisely why the comments aren’t pointless! I appreciate the kudos, but am even more pleased by the way people have helped each other with this issue above and beyond my little “assembly.”

      Cheers, MG.

  16. Luca Marino says

    Hi, Thanks for this great tutorial.
    I still have a problem with mcrypt module. I had followed all the istruction but no chanches to see mcrypt in my phpinfo.

    Any suggestion?

  17. Jerry says

    Many thanks for posting these instructions, but to be honest I don’t understand what I am doing! I want to experiment with another program that requires mysql and mcrypt, and I am using a Mac Mini with Lion Server.

    I intalled xcode 4.1, and downloaded php & libmrcypt. Moved the last two to a new folder and ran the long bit of code. I get the following message, which I assume I should not get…..

    libmcrypt jerryhart$ MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ ./configure –disable-dependency-tracking
    checking build system type… i686-apple-darwin11.2.0
    checking host system type… i686-apple-darwin11.2.0
    checking target system type… i686-apple-darwin11.2.0
    checking for a BSD-compatible install… /usr/bin/install -c
    checking whether build environment is sane… yes
    checking for gawk… no
    checking for mawk… no
    checking for nawk… no
    checking for awk… awk
    checking whether make sets $(MAKE)… no
    checking whether to enable maintainer-specific portions of Makefiles… no
    checking whether make sets $(MAKE)… (cached) no
    checking for g++… no
    checking for c++… no
    checking for gpp… no
    checking for aCC… no
    checking for CC… no
    checking for cxx… no
    checking for cc++… no
    checking for cl… no
    checking for FCC… no
    checking for KCC… no
    checking for RCC… no
    checking for xlC_r… no
    checking for xlC… no
    checking for C++ compiler default output file name… configure: error: C++ compiler cannot create executables
    See `config.log’ for more details.

    Any suggestions what I have done wrong? Any help for a non-programmer would be most appreciated! Thanks indvance

    Jerry

    • Mike R. says

      Jerry, after downloading Xcode from the Apple App Store, did you install it? I received the same error as you, and realized after grabbing from the App Store, I didn’t run the install. (I noticed I had no C compiler installed–which is what this message means.)

      Just go up to your Spotlight, type “Install Xcode” and hit enter.

      Hope this helps! –mr

      • Alex says

        I had to:
        Start Xcode-> Menu-> Preferences…-> Downloads tab-> Click ‘Install’ next to ‘Commandline tools’.

        Cheers,
        Alex

  18. says

    Everything works fine until I run phpize. Then I get the following:

    Configuring for:
    PHP Api Version: 20090626
    Zend Module Api No: 20090626
    Zend Extension Api No: 220090626
    /usr/local/bin/autoconf: /usr/local/bin/autom4te: /opt/local/bin/perl: bad interpreter: No such file or directory
    /usr/local/bin/autoconf: line 501: /usr/local/bin/autom4te: Undefined error: 0

    Any idea where to go from here…? Thanks for any guidance…

  19. says

    Couple of issues that I was having:

    I couldn’t get libmcrypt to configure, it seemed to be complaining that libmcrypt-config didn’t exist:

    *** Could not run libmcrypt test program, checking why...
    *** The test program failed to compile or link. See the file config.log for the
    *** exact error that occured. This usually means LIBMCRYPT was incorrectly installed
    *** or that you have moved LIBMCRYPT since it was installed. In the latter case, you
    *** may want to edit the libmcrypt-config script: no
    configure: error: *** libmcrypt was not found

    So I used brew to compile and re-configured it and re-installed it successfully. I also had to remove all references to -arch i386 as presumably brew only installs the relevant architecture for libmcrypt (x86_64 on Lion) so it was still complaining with the same error. Removing -arch i386 from all of the configures mentioned above fixed it. I also had to download and install libmhash with a simple ./configure && make && sudo make install for dependencies.

    I was also having an issue with the make step of libmcrypt complaining about an error with the rfc2242.o build:

    make[2]: *** [rfc2440.o] Error 1

    From a bit of googling it appeared to be an invalid reference to a source file that’s in a different location on Mac OS X, so editing ./src/rfc2242.c and changing the following line:

    #include

    to refer to sys/malloc.h (where it resides on Lion) also fixed this make issue. I also used standard makes (instead of make -j6) everywhere to ensure smooth-sailing.

  20. Kay says

    When you say create a directory at root called ‘SourceCache’ , where is that exactly? I’ve put it under Macintosh HD/Developer and have XCode already installed. I’ve been able to follow right up to the last instruction. I see two php.ini files (php.ini-development and php.ini-production) but nothing close to php.ini.default. Also, I’m not sure which /etc directory I should be looking for. Can you clarify exact file paths and commands to get through this last part for those of us learning all this for the first time? Many thanks! So close and yet so far.

    Make sure you have php.ini in the /etc directory – it will probably be php.ini.default to start, particularly if you’ve just done an OS X upgrade or a clean Lion install, so rename it. Ensure that enable_dl = On but do not remove the ; from in front of ;extension_dir = “./”. Add one line to the .ini file in the Dynamic Extensions section… extension=mcrypt.so

  21. Marabiloso says

    It works… almost.
    On the first “killall -1 httpd” it doesn’t see the changes in php.ini.default. I guess it’s just not ignored, as “ln -s /etc/php.ini.default /etc/php.ini && killall -1 httpd” did it perfectly… and phpMyAdmin works like a charm! :-)

  22. says

    For Zend Server CE change this:

    ./configure –with-php-config=/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config

    to:

    ./configure –with-php-config=/usr/local/zend/bin/php-config

    Otherwise, works great!

  23. Homer says

    Thanks for this post. Really helpful in getting libmcrypt.so up for php.

    Some of us may still be getting an error in make (php-5.3.x/ext/mcrypt) that goes like this–


    /tmp/source/php-5.3.8/ext/mcrypt/mcrypt.c:283: error: ‘PHP_FE_END’ undeclared here (not in a function)
    /tmp/source/php-5.3.8/ext/mcrypt/mcrypt.c:283: error: ‘PHP_FE_END’ undeclared here (not in a function)
    lipo: can’t figure out the architecture type of: /var/folders/yx/mjbztxd5115_557vh6bz45p80000gn/T//ccipgsqR.out
    make: *** [mcrypt.lo] Error 1

    Solution is to open mcrypt.c and replace PHP_FE_END with {NULL,NULL,NULL}. I got this from here.

    Peace!

      • Jean-Yves says

        Same here, I had that exact error. Thank you.

        And thanks to Michael once again for his instructions (I used your Snow Leopard instructions before with equally good results)

        I used the PHP 5.3.10 sources to match my current copy of PHP without issues (I remember on the SL process there were some issues with certain versions of the source code)

  24. Alexandre Pinheiro says

    Hi Michael,

    Thank you very much for this post.

    I did all the steps, but mcrypt module does not working yet.

    Please, could you help me?

    My configs:
    1. /usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so

    2. (locate mcrypt.so) /usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so

    3. (php.ini)
    extension_dir=”/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/”
    extension=mcrypt.so

    And after restart Apache, the command “php -info | grep crypt” returns nothing.

    Have you any idea?

    Thank you for advance.

    • says

      The best I can suggest is clearing everything out and starting over, paying close attention to versions and compilation messages. I’d review the comments to see if anyone else has run into a similar issue. Sorry I can’t be of more help, but there isn’t an efficient way to replicate whatever is happening to you from afar.

  25. says

    Everthing worked OK until the step “make -j6″ for php-5.3.8/ext/mcrypt. Error:
    /SourceCache/php-5.3.8/ext/mcrypt/mcrypt.c:283: error: ‘PHP_FE_END’ undeclared here (not in a function)
    make: *** [mcrypt.lo] Error 1

    I did do the subsequent sudo make install but of course that still gave an error. And of course after restarting apache, phpinfo() shows no mcrypt loaded.

    Throughout I did copy/paste to the Terminal command line what you posted, so there’s no question of typing errors.

    • says

      Yea..skipping to the next step won’t get you anywhere. Gotta clean everything out and start over. When you get to make -j6, stop. Then go into the file in question and replace all occurrences of “PHP_FE_END” with “{NULL,NULL,NULL}” – see if the rest works after that.

      • says

        Michael Gracie: Thank you for the suggestion, but I don’t fully understand it.

        You wrote, “When you get to make -j6″ stop. Do you mean stop beforethat make step?

        And do you mean to do this for both the first part involving libmcrypt and then the part involving php/ext/mcrypt? Or just the latter.

        You wrote, “go into the file in question…” _Which_ file in question? the make file?

        • says

          Clarification….

          You are failing at make -j6, so no need to execute that. Hence, stop before producing the error again. Then, the file on which the error is occurring is /SourceCache/php-5.3.8/ext/mcrypt/mcrypt.c, so this is the file you should edit.

          Good?

          UPDATE: FYI there is only one occurrence in that file, on line 283.

          • says

            Just realized a problem with your original instructions for doing the part of the installation involving php-5.3.8/ext/mcrypt. (I have version 5.3.8 while you have 5.3.6).
            You have./configure --with-php-config=/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config
            but for Xcode 4.3 that needs to be changed to:
            ./configure --with-php-config=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config

          • says

            With the change to the --with-php-config value that I indicated as needed for Xcode 4.3, and with your suggested change in mcrypt.c (replacing PHP_FE_END by {NULL,NULL,NULL}, the make now goes OK. And mcrypt shows up as an installed php module when I restart apache.

            Thanks for the help. (And it really helps when I’m doing this rather ignorant of details of what’s really going on — beyond understanding, of course, what a configure and what a make and what a make install do.)

  26. Nguyen Tran Viet says

    This works great on my Mac installing Xcode 4.2.
    But on my other machine installing Xcode 4.3, when run ./configure to install libmcrypt-2.5.8, it produce the error:


    Applehouses-MacBook-Pro-7:libmcrypt-2.5.8 Applehouse$ ./configure
    checking build system type... i686-apple-darwin11.3.0
    checking host system type... i686-apple-darwin11.3.0
    checking target system type... i686-apple-darwin11.3.0
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for gawk... no
    checking for mawk... no
    checking for nawk... no
    checking for awk... awk
    checking whether make sets $(MAKE)... no
    checking whether to enable maintainer-specific portions of Makefiles... no
    checking whether make sets $(MAKE)... (cached) no
    checking for g++... no
    checking for c++... no
    checking for gpp... no
    checking for aCC... no
    checking for CC... no
    checking for cxx... no
    checking for cc++... no
    checking for cl... no
    checking for FCC... no
    checking for KCC... no
    checking for RCC... no
    checking for xlC_r... no
    checking for xlC... no
    checking for C++ compiler default output file name... configure: error: C++ compiler cannot create executables
    See `config.log' for more details.

    I’m not sure whether Xcode 4.3 is the reason. Please help me

    • says

      Very likely is the 4.3, which no longer has an installer. Hence, command line tools need to be manually installed.

      Launch Xcode 4.3, then go to Preferences > Downloads. Hit the Install button next to Command Line Tools.

      Should be good after that.

      • Nguyen Tran Viet says

        Dear,
        Thanks for your support. I still encounter problem, another problem. When in php-5.3.6/ext/mcrypt, I can not run the “./configure” statement, it says:


        -bash: ./config: No such file or directory

        Thank you

        • says

          Sounds like a path issue now. If you type gcc -v and/or gcc -v and get zippo back, search for the path fix. If you get results back that end with “gcc version 4.2.1″ then I am at a loss (for the time being at least).

      • Nguyen Tran Viet says

        The result of run “gcc -v” is:

        sh-3.2# gcc -v
        Using built-in specs.
        Target: i686-apple-darwin11
        Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
        Thread model: posix
        gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)

  27. Nguyen Tran Viet says

    Before it, when I run phpize, it shows:

    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. Then, rerun this script.

    Please help me. Thank you!

  28. says

    Just thought I’d let you know the new php-config path, since Xcode is a self-contained app now (meaning no more /Developer folder):

    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config

  29. says

    I’m having trouble when doing the make install and this is what I’m getting:

    Making install in modules
    Making install in algorithms
    test -z “/usr/local/lib/libmcrypt” || /bin/sh ../../mkinstalldirs “/usr/local/lib/libmcrypt”
    make[3]: Nothing to be done for `install-data-am’.
    Making install in modes
    test -z “/usr/local/lib/libmcrypt” || /bin/sh ../../mkinstalldirs “/usr/local/lib/libmcrypt”
    make[3]: Nothing to be done for `install-data-am’.
    make[3]: Nothing to be done for `install-exec-am’.
    make[3]: Nothing to be done for `install-data-am’.
    Making install in include
    make[2]: Nothing to be done for `install-exec-am’.
    test -z “/usr/local/include” || /bin/sh ../mkinstalldirs “/usr/local/include”
    /source/libmcrypt-2.5.8/install-sh -c -m 644 ‘mcrypt.h’ ‘/usr/local/include/mcrypt.h’
    /source/libmcrypt-2.5.8/install-sh -c -m 644 ‘mutils/mcrypt.h’ ‘/usr/local/include/mutils/mcrypt.h’
    Making install in lib
    test -z “/usr/local/bin” || /bin/sh ../mkinstalldirs “/usr/local/bin”
    /usr/local/ant/install -c ‘libmcrypt-config’ ‘/usr/local/bin/libmcrypt-config’
    /bin/sh: /usr/local/ant/install: Permission denied
    make[2]: *** [install-binSCRIPTS] Error 126
    make[1]: *** [install-am] Error 2
    make: *** [install-recursive] Error 1

    I’m not sure why it’s referring to the Ant install. I have Xcode 4.3 and the command line tools installed so I’m at a lost at what is going on.

    • says

      Figured it out. For some reason the installation of Ant was causing an issue with the configure and make. Temporarily removed the Ant folder in /usr/local, ran through all the steps and it worked fine.

  30. Mish says

    I can not thank you enough, Mike! This post really helped.
    I hope my notes below will help people on Lion 10.7.3 and with Xcode 4.3.2.

    I had a brand new out of the box mac mini with 10.7.3 installed.

    - I started by installing the entropy package which I like and always used in the past. But after my usual installation routine, things didn’t go smoothly. Apache was crashing with the following error:

    “[notice] child pid XXX exit signal Segmentation fault (11)”

    After a little bit of research I have concluded that the current entropy package is not compatible with 10.7.3

    So I found your post.

    - My first problem was using tcshrc shell, not bash. None of the commands were working, unless I switched to bash, by going Terminal->Prefrences->Startup->Open Shell With->Command and entering /bin/bash

    - Then I ran into permission issues. For some reason I had to use sudo on all commands. So, for example in your first command I had to type “sudo” before ./configure. As in:

    MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ sudo ./configure –disable-dependency-tracking

    - Then /usr/bin/phpize didn’t work. I kept getting an error:

    “Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
    environment variable is set correctly and then rerun this script.”

    So I found this wonderful post that helped me to solve this issue. It basically tells you how t o install the latest autoconf and automake on Mac:

    http://www.mattvsworld.com/blog/2010/02/install-the-latest-autoconf-and-automake-on-mac-os-10-6/

    - My Xcode version is 4.3.2. Some components of Xcode 4.3.2 required for mcrypt installation are optional. Specifically, the “command line tools”. Honestly I already forgot why exactly I needed it for, but I had to go to Xcode->Preferences->Downloads and click on Install button next to the “Command Line Tools”.

    - Finally, in Xcode 4.3.2 they moved /Developer folder from root to Xcode application bundle. So the command below didn’t work:

    MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ ./configure –with-php-config=/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config

    Instead, I had to use the correct path for php-config:

    MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ sudo ./configure –with-php-config=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config

    The last one has a correct path to php-config for Xcode 4.3.2

    ————–

    And bingo! After 4 hours of fun I have mcrypt running on native php 5.3.8 Mac installation.

    Needless to say, without your post I would never be able to figure this out and I was too close to use MAMP which I really try to avoid. So thanks again!

    • Maximo says

      I followed all of the above and everything works smoothly except for mcrypt. There was an error during, make -j6
      I am on OSX 10.7.4, php 5.3.10. the error seems to be a bug on PHP related to ‘const char *’. Any ideas?
      Thanks,,

      sh-3.2# MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ ./configure –with-php-config=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config
      checking for grep that handles long lines and -e… /usr/bin/grep
      checking for egrep… /usr/bin/grep -E
      checking for a sed that does not truncate output… /usr/bin/sed
      checking for cc… cc
      checking whether the C compiler works… yes
      checking for C compiler default output file name… a.out
      checking for suffix of executables…
      checking whether we are cross compiling… no
      checking for suffix of object files… o
      checking whether we are using the GNU C compiler… yes
      checking whether cc accepts -g… yes
      checking for cc option to accept ISO C89… none needed
      checking how to run the C preprocessor… cc -E
      checking for icc… no
      checking for suncc… no
      checking whether cc understands -c and -o together… yes
      checking for system library directory… lib
      checking if compiler supports -R… no
      checking if compiler supports -Wl,-rpath,… yes
      checking build system type… i386-apple-darwin11.4.0
      checking host system type… i386-apple-darwin11.4.0
      checking target system type… i386-apple-darwin11.4.0
      checking for PHP prefix… /usr
      checking for PHP includes… -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
      checking for PHP extension directory… /usr/lib/php/extensions/no-debug-non-zts-20090626
      checking for PHP installed headers prefix… /usr/include/php
      checking if debug is enabled… no
      checking if zts is enabled… no
      checking for re2c… no
      configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
      checking for gawk… no
      checking for nawk… no
      checking for awk… awk
      checking if awk is broken… no
      checking for mcrypt support… yes, shared
      checking for libmcrypt version… >= 2.5.6
      checking for mcrypt_module_open in -lmcrypt… yes
      checking for ld used by cc… /usr/bin/ld
      checking if the linker (/usr/bin/ld) is GNU ld… no
      checking for /usr/bin/ld option to reload object files… -r
      checking for BSD-compatible nm… /usr/bin/nm
      checking whether ln -s works… yes
      checking how to recognize dependent libraries… pass_all
      checking for ANSI C header files… yes
      checking for sys/types.h… yes
      checking for sys/stat.h… yes
      checking for stdlib.h… yes
      checking for string.h… yes
      checking for memory.h… yes
      checking for strings.h… yes
      checking for inttypes.h… yes
      checking for stdint.h… yes
      checking for unistd.h… yes
      checking dlfcn.h usability… yes
      checking dlfcn.h presence… yes
      checking for dlfcn.h… yes
      checking the maximum length of command line arguments… 196608
      checking command to parse /usr/bin/nm output from cc object… ok
      checking for objdir… .libs
      checking for ar… ar
      checking for ranlib… ranlib
      checking for strip… strip
      checking for dsymutil… dsymutil
      checking for nmedit… nmedit
      checking for -single_module linker flag… yes
      checking for -exported_symbols_list linker flag… yes
      checking if cc supports -fno-rtti -fno-exceptions… yes
      checking for cc option to produce PIC… -fno-common
      checking if cc PIC flag -fno-common works… yes
      checking if cc static flag -static works… no
      checking if cc supports -c -o file.o… yes
      checking whether the cc linker (/usr/bin/ld) supports shared libraries… yes
      checking dynamic linker characteristics… darwin11.4.0 dyld
      checking how to hardcode library paths into programs… immediate
      checking whether stripping libraries is possible… yes
      checking if libtool supports shared libraries… yes
      checking whether to build shared libraries… yes
      checking whether to build static libraries… no

      creating libtool
      appending configuration tag “CXX” to libtool
      configure: creating ./config.status
      config.status: creating config.h
      sh-3.2# make -j6
      /bin/sh /usr/sourcecache/php-5.3.10/ext/mcrypt/libtool –mode=compile cc -I. -I/usr/sourcecache/php-5.3.10/ext/mcrypt -DPHP_ATOM_INC -I/usr/sourcecache/php-5.3.10/ext/mcrypt/include -I/usr/sourcecache/php-5.3.10/ext/mcrypt/main -I/usr/sourcecache/php-5.3.10/ext/mcrypt -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -O3 -fno-common -arch i386 -arch x86_64 -c /usr/sourcecache/php-5.3.10/ext/mcrypt/mcrypt.c -o mcrypt.lo
      /bin/sh /usr/sourcecache/php-5.3.10/ext/mcrypt/libtool –mode=compile cc -I. -I/usr/sourcecache/php-5.3.10/ext/mcrypt -DPHP_ATOM_INC -I/usr/sourcecache/php-5.3.10/ext/mcrypt/include -I/usr/sourcecache/php-5.3.10/ext/mcrypt/main -I/usr/sourcecache/php-5.3.10/ext/mcrypt -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -O3 -fno-common -arch i386 -arch x86_64 -c /usr/sourcecache/php-5.3.10/ext/mcrypt/mcrypt_filter.c -o mcrypt_filter.lo
      mkdir .libs
      cc -I. -I/usr/sourcecache/php-5.3.10/ext/mcrypt -DPHP_ATOM_INC -I/usr/sourcecache/php-5.3.10/ext/mcrypt/include -I/usr/sourcecache/php-5.3.10/ext/mcrypt/main -I/usr/sourcecache/php-5.3.10/ext/mcrypt -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -O3 -fno-common -arch i386 -arch x86_64 -c /usr/sourcecache/php-5.3.10/ext/mcrypt/mcrypt.c -fno-common -DPIC -o .libs/mcrypt.o
      cc -I. -I/usr/sourcecache/php-5.3.10/ext/mcrypt -DPHP_ATOM_INC -I/usr/sourcecache/php-5.3.10/ext/mcrypt/include -I/usr/sourcecache/php-5.3.10/ext/mcrypt/main -I/usr/sourcecache/php-5.3.10/ext/mcrypt -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -O3 -fno-common -arch i386 -arch x86_64 -c /usr/sourcecache/php-5.3.10/ext/mcrypt/mcrypt_filter.c -fno-common -DPIC -o .libs/mcrypt_filter.o
      /usr/sourcecache/php-5.3.10/ext/mcrypt/mcrypt_filter.c:210:37: warning: passing
      ‘const char *’ to parameter of type ‘char *’ discards qualifiers
      [-Wincompatible-pointer-types]
      mcrypt_module = mcrypt_module_open(cipher, algo_dir, mode, mode_dir);
      ^~~~~~
      /usr/local/include/mutils/mcrypt.h:38:34: note: passing argument to parameter ‘algorithm’
      here
      MCRYPT mcrypt_module_open(char *algorithm,
      ^
      /usr/sourcecache/php-5.3.10/ext/mcrypt/mcrypt.c:693:2: warning: initializing
      ‘const char *’ with an expression of type ‘unsigned char *’ converts between
      pointers to integer types with different sign [-Wpointer-sign]
      RETVAL_STRINGL(data_s, data_size, 1);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/php/Zend/zend_API.h:585:42: note: expanded from macro ‘RETVAL_STRINGL’
      #define RETVAL_STRINGL(s, l, duplicate) ZVAL_STRINGL(return_value, s, l, …
      ^
      /usr/include/php/Zend/zend_API.h:547:15: note: expanded from macro ‘ZVAL_STRINGL’
      const char *__s=(s); int __l=l; \
      ^ ~~~
      1 warning generated.
      /usr/sourcecache/php-5.3.10/ext/mcrypt/mcrypt_filter.c:210:37: warning: passing
      ‘const char *’ to parameter of type ‘char *’ discards qualifiers
      [-Wincompatible-pointer-types]
      mcrypt_module = mcrypt_module_open(cipher, algo_dir, mode, mode_dir);
      ^~~~~~
      /usr/local/include/mutils/mcrypt.h:38:34: note: passing argument to parameter ‘algorithm’
      here
      MCRYPT mcrypt_module_open(char *algorithm,
      ^
      1 warning generated.
      1 warning generated.
      /usr/sourcecache/php-5.3.10/ext/mcrypt/mcrypt.c:693:2: warning: initializing
      ‘const char *’ with an expression of type ‘unsigned char *’ converts between
      pointers to integer types with different sign [-Wpointer-sign]
      RETVAL_STRINGL(data_s, data_size, 1);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/php/Zend/zend_API.h:585:42: note: expanded from macro ‘RETVAL_STRINGL’
      #define RETVAL_STRINGL(s, l, duplicate) ZVAL_STRINGL(return_value, s, l, …
      ^
      /usr/include/php/Zend/zend_API.h:547:15: note: expanded from macro ‘ZVAL_STRINGL’
      const char *__s=(s); int __l=l; \
      ^ ~~~
      1 warning generated.
      /bin/sh /usr/sourcecache/php-5.3.10/ext/mcrypt/libtool –mode=link cc -DPHP_ATOM_INC -I/usr/sourcecache/php-5.3.10/ext/mcrypt/include -I/usr/sourcecache/php-5.3.10/ext/mcrypt/main -I/usr/sourcecache/php-5.3.10/ext/mcrypt -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -O3 -fno-common -arch i386 -arch x86_64 -O3 -arch i386 -arch x86_64 -o mcrypt.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/sourcecache/php-5.3.10/ext/mcrypt/modules mcrypt.lo mcrypt_filter.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lmcrypt -lltdl
      cc ${wl}-undefined ${wl}dynamic_lookup -o .libs/mcrypt.so -bundle .libs/mcrypt.o .libs/mcrypt_filter.o -L/usr/local/lib /usr/local/lib/libmcrypt.dylib /usr/local/lib/libltdl.dylib -arch i386 -arch x86_64 -arch i386 -arch x86_64 -Wl,-rpath -Wl,/usr/local/lib
      ld: warning: ignoring file /usr/local/lib/libltdl.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
      dsymutil .libs/mcrypt.so || :
      warning: no debug symbols in executable (-arch i386)
      warning: no debug symbols in executable (-arch x86_64)
      creating mcrypt.la
      (cd .libs && rm -f mcrypt.la && ln -s ../mcrypt.la mcrypt.la)
      /bin/sh /usr/sourcecache/php-5.3.10/ext/mcrypt/libtool –mode=install cp ./mcrypt.la /usr/sourcecache/php-5.3.10/ext/mcrypt/modules
      cp ./.libs/mcrypt.so /usr/sourcecache/php-5.3.10/ext/mcrypt/modules/mcrypt.so
      cp ./.libs/mcrypt.lai /usr/sourcecache/php-5.3.10/ext/mcrypt/modules/mcrypt.la
      ———————————————————————-
      Libraries have been installed in:
      /usr/sourcecache/php-5.3.10/ext/mcrypt/modules

      If you ever happen to want to link against installed libraries
      in a given directory, LIBDIR, you must either use libtool, and
      specify the full pathname of the library, or use the `-LLIBDIR’
      flag during linking and do at least one of the following:
      – add LIBDIR to the `DYLD_LIBRARY_PATH’ environment variable
      during execution

      See any operating system documentation about shared libraries for
      more information, such as the ld(1) and ld.so(8) manual pages.
      ———————————————————————-

      Build complete.
      Don’t forget to run ‘make test’.

  31. rols says

    Great post. Worked fine.

    To all the people who got the “configure: error: *** libmcrypt was not found” error, you’re most likely building the wrong package, you’re building mcrypt and no libmcrypt. It’s super-easy to download the wrong one because the sourceforge site is so confusing.

    For Xcode recent versions the SDKs have moved and so you need


    MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config

    I would recommend running ‘make test’ after you build the second piece, just to be sure it’s all working as it should be.

  32. Sola says

    Awesome post!

    If you have Xcode 3.x.x and mac OS X 10.6.x, you can change MACOSX_DEPLOYMENT_TARGET=10.7
    to
    MACOSX_DEPLOYMENT_TARGET=10.6.

    This worked for me.

    Once again, thanks for this post – it’s spot on.

  33. Johnny says

    that was great! I spent so much time looking for the right way to build in mcrypt library on Mac lion.
    Thank you so much!

    • Mario says

      5 minutes ago and everything is ok. I’ve used these downloads:

      http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.bz2/download
      php 5.3.15 source code (I couldn’t found source code for php installed on ML)


      tar -xvf libmcrypt-2.5.8.tar.bz2
      cd libmcrypt-2.5.8/
      MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --disable-dependency-tracking
      make -j6
      sudo make install
      cd ..
      tar xvf php-5.3.15.tar.bz2
      cd php-5.3.15/ext/mcrypt/
      /usr/bin/phpize
      MACOSX_DEPLOYMENT_TARGET=10.8 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/usr/bin/php-config
      make -j6
      make test
      sudo make install

      • Max says

        Xcode 4.4 doesn’t include autoconfi, so phpize won’t work. To fix, install autoconf via Brew (brew install autoconf).

    • says

      I installed autoconf via homebrew and then for libmcrypt’s configure, I used:

      MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ ./configure –disable-dependency-tracking

      and for the php extension:

      MACOSX_DEPLOYMENT_TARGET=10.8 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ ./configure –with-php-config=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/bin/php-config

      Regards,
      Rob…

  34. Arleena Faith says

    FYI this was awesome. Tried so many things and nothing worked but your tutorial finally made my Magento see the mcrypt install. Note that when I tried to configure oho I was missing the autoconf, which I successfully then added through ‘brew install autoconf’ and right after attempting to configure again, I had to locate my php-config which was in the ‘/usr/bin/php-config’ directory. So my version of your configure for php was,
    ‘MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ sudo ./configure –with-php-config=/usr/bin/php-config’
    and Magento loaded…yay!
    Tks a lot.

  35. says

    You are awesome. This worked for me….on Mountain Lion (10.8.2) with php version 5.3.15. However, I had to change:
    MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config
    TO:
    MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/usr/bin/php-config
    But, thank you so much.

  36. Juan Ruiz says

    Works almost perfect.

    When executed the command /usr/bin/phpize this error appeared:
    $PHP_AUTOCONF environment variable. Then, rerun this script.

    This one was solved with this commands

    curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
    tar xzf autoconf-latest.tar.gz
    cd autoconf-2.69/
    ./configure --prefix=/usr/local
    sudo make install

    I also changed the path at the end of this scriipt:

    MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ ./configure –with-php-config=/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config

    to

    MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ ./configure –with-php-config=/usr/bin/php-config

    Thanks!

  37. Mike says

    I am receiving the same error using these instructions:

    Michael-Sutyaks-MacBook-Pro:mcrypt michaelsutyak$ MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64′ ./configure –with-php-config=/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config
    checking for grep that handles long lines and -e… /usr/bin/grep
    checking for egrep… /usr/bin/grep -E
    checking for a sed that does not truncate output… /usr/bin/sed
    checking for cc… cc
    checking for C compiler default output file name… a.out
    checking whether the C compiler works… yes
    checking whether we are cross compiling… no
    checking for suffix of executables…
    checking for suffix of object files… o
    checking whether we are using the GNU C compiler… yes
    checking whether cc accepts -g… yes
    checking for cc option to accept ISO C89… none needed
    checking how to run the C preprocessor… cc -E
    checking for icc… no
    checking for suncc… no
    checking whether cc understands -c and -o together… yes
    checking for system library directory… lib
    checking if compiler supports -R… no
    checking if compiler supports -Wl,-rpath,… yes
    checking build system type… i386-apple-darwin11.4.2
    checking host system type… i386-apple-darwin11.4.2
    checking target system type… i386-apple-darwin11.4.2
    checking for PHP prefix… /usr
    checking for PHP includes… -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
    checking for PHP extension directory… /usr/lib/php/extensions/no-debug-non-zts-20090626
    checking for PHP installed headers prefix… /usr/include/php
    checking if debug is enabled… no
    checking if zts is enabled… no
    checking for re2c… no
    configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
    checking for gawk… no
    checking for nawk… no
    checking for awk… awk
    checking if awk is broken… no
    checking for mcrypt support… yes, shared
    checking for libmcrypt version… >= 2.5.6
    checking for mcrypt_module_open in -lmcrypt… no
    checking for mcrypt_module_open in -lmcrypt… no
    configure: error: Sorry, I was not able to diagnose which libmcrypt version you have installed.

    Any idea how I can change this? Everything is up to date.

Trackbacks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>