Plugging mcrypt into PHP, on Leopard 10.5.6
mcrypt on Fedora Core easy – on Leopard with PHP 5.2.6 not so much.
The instructions below cater to those folks who a) are developing on OS X Leopard 10.5.6, 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;
2) PHP 5.2.6 source, which you grab here; and
3) Xcode 3 tools (dig through your sock drawer to find your Leopard disk).
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.5 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' LDFLAGS='-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' ./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.2.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.5 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' LDFLAGS='-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' ./configure --with-php-config=/Developer/SDKs/MacOSX10.5.sdk/usr/bin/php-config
Again make -j6 then sudo make install
Make sure you have php.ini in the /etc directory (it may be php.ini.default to start, so rename it). Ensure that enable_dl = On but do not remove the ; from in front of ;extension_dir = "./". UPDATE: Almost forgot – add one line to the .ini file in the Dynamic Extensions section… ‘extension=mcrypt.so’, without the quotes of course (thanks to Badrul).
Restart Apache – when all’s said and done you should be able to see this with phpinfo():

Special thanks go to salty beagle and Kenior Design for giving me the clues to getting the combination of events right.
MORE: Two commenters noted they had their success with the above after updated Xcode to 3.1.2.












December 27th, 2008 at 12:05 am
But why would I want to??
Merry Christmas! and Happy New Year!
December 27th, 2008 at 10:42 am
The answer to that, my old friend, is enigmatic. Now shut thy cake trap and email me some fam-damily X-mas pics!
December 31st, 2008 at 2:45 pm
Sweet! Nicely done.
January 2nd, 2009 at 6:54 am
Thanks for the guide.
I followed word by word, except the fact that I had to run them as a sudo.
But I don’t see it in phpinfo()
There was no compile error. The shared mcrypt extension was install in /usr/lib/php/extensions/no-debug-non-zts-20060613/ . php.ini was in /etc and has enable_dl = On and ;extension_dir =”./”
From phpinfo(), the configure command was :
‘/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’
There isn’t anything in apache2 log files to indicate an error anywhere.
Any ideas ?
January 2nd, 2009 at 7:15 am
I’ve added in /etc/php.ini
extension=mcrypt.so
The error log now reports :
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/extensions/no-debug-non-zts-20060613/mcrypt.so’ – (null) in Unknown on line 0
January 2nd, 2009 at 8:10 am
Badrul – the Apache is the same as mine, so that is likely not the issue. Had you previously tried compilation, with or without apparent errors? Reason I ask – when I was trying over and over with slight variations, I found that I had to delete the source folders and untar fresh source before recompiling. The latest error you are finding in the log is the same one I got many times previously before figuring that out – try deleting the source folders, untar the archive source files, and trying compilation again.
Also, thanks for the extension bit – I forgot that, and have updated the post.
January 6th, 2009 at 1:59 pm
Hi, I’m following through but on the second make -j6 I get “make: *** No targets specified and no makefile found. Stop.” Any idea what’s causing that?
January 6th, 2009 at 2:03 pm
Weird. Are you sure you are in the directory where the mcrypt-related PHP source is?
Rather than try and troubleshoot a funky problem, you may want to just delete the source folder and un-tar a new one. Then go back into that directory and start again with /usr/bin/phpize…
After a ton of trouble, that finally worked for me.
January 6th, 2009 at 2:17 pm
Started with a new source folder and it worked great. Thanks Michael.
January 6th, 2009 at 2:19 pm
Awesome!
January 9th, 2009 at 8:52 am
Michael,
I updated XCode to the latest version (3.1.2) and problem solved. Thank you. (I initially did it using XCode installed from Leopard Server DVD)
January 9th, 2009 at 10:31 am
Very glad it worked out. And thanks for reminding me about loading the extension in php.ini. Cheers.
January 16th, 2009 at 8:22 pm
Thank you very much! Worked like a charm. This has been bugging me and I haven’t had time to research the steps on my own. Cheers!
January 17th, 2009 at 11:11 am
Glad to hear it Ryan. We aim to please. Now, let me know when you get “The Missing Manual” written for mcrypt (we only just figured out you can specify both the block chaining and the algorithm with it).
January 26th, 2009 at 5:07 am
Many thanks, brilliant tutorial! And thanks also to Badrul’s comments – particularly about updating xcode to 3.1.2 before compiling php… perhaps that should be noted in the tutorial?
Great work all,
January 26th, 2009 at 7:23 am
Badrul’s note added. Cheers.
February 11th, 2009 at 1:25 pm
This worked great for me as well !! The only slow down I had was that “extension_dir” was not commented out in my default php.ini file (for whatever reason) and I once I comment that out – mcrypt started showing fine in my phpinfo() page.
Many thanks for an extremely helpful tutorial!
February 13th, 2009 at 2:10 pm
Thanks so much for the tutorial! It was clear and easy to follow. Keep posting.
February 13th, 2009 at 2:13 pm
My only feedback would be to explain what the instructions do. Ex: This will build PHP.
Thanks again.
February 13th, 2009 at 2:35 pm
A simple introduction…now why didn’t I think of that? Done, and thanks kindly.
February 15th, 2009 at 12:55 am
Thanks – this worked like a charm. I am grateful for the effort you put into creating this guide. It is very much appreciated.
February 21st, 2009 at 2:39 pm
Hello all,
Ive followed the instructions above and for some reason I still cant see it on the phpinfo(). The reason i was trying to get mcrypt working is because im trying to set up phpMyAdmin and it says that it ‘cant load the mcrypt extension. please check your PHP configuration.’
im not sure if ive set up my config files 100% correctly as far as matching usernames etc. (im not sure if that matters at all). Im guessing you might need more information to help me out but im new to this and not familir with what you might need.
Any help would be greatly appreciated!
February 21st, 2009 at 9:33 pm
No prob – let’s start with PHP, OS, and XCode version you are running. Not sure whether Xcode is an issue, but some folks said it was (I was running 3.0 at the time).
February 21st, 2009 at 11:35 pm
PHP 5.2.6
OS 10.5
Xcode 3.1
phpMyAdmin 3.1.2
MySQL 5.1.3
It turns out i just had to run my computer to get the mcrypt working, Thanks for the help!
Maybe I should post this somewhere else but there is another thing now.. Ive spent nearly a 2 months setting all of this up and its all to install Drupal. Im at the stage where I need to create a database (Ive decided to use phpMyAdmin to do it) and for some reason when I try to log in to phpmyadmin as user: root is says access is denied. In the config.inc.php file for phpmyadmin I set the authtype to config and Ive set the user and password to ‘root’ and ” (empty). Im pretty sure i have the same settings for MySQL (which i changed by logging in through a shell).
I have no idea if theres something else I need to be aware of that im missing because if not, i dont know ehere to go from here.
February 21st, 2009 at 11:36 pm
** i meant to say restart my computer
February 22nd, 2009 at 9:21 am
Note: You can probably just restart Apache instead of rebooting, but I’m assuming you got it working. Great.
As for phpMyAdmin, I’d love to help but really can’t. I use the MySQL admin tools, along with CocoaMySQL, on the desktop. And Webmin and the terminal window when on Linux.
Best, MG.
February 27th, 2009 at 12:26 pm
Thank you for this, Michael. It’s been a huge help for me and my team.
February 28th, 2009 at 10:08 pm
Very nice — thank you. For what it’s worth, it didn’t work for me until I upgraded XTools to 3.1.2. Nice, though. Rare that you find something that works first time out.
March 1st, 2009 at 12:17 pm
@Marco/Jim: No prob – glad it helped.
March 2nd, 2009 at 2:19 pm
Thanks a lot for this writing it helped me a lot to configure phpmyadmin on my machine! It was complaining about mcrypt, and now it works!
March 3rd, 2009 at 2:13 pm
Really helpful.! Took me a while to figure it out, but that’s because i had no idea what i was doing and had to go back to terminal 101. Thanks so much.
March 4th, 2009 at 1:18 pm
I’m new to mac so this maybe a dumb question, but when I try to compile and run gcc -MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ LDFLAGS=’-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ ./configure –disable-dependency-tracking
It is saying “No such file or directory”. Any thoughts. It seems pretty straight forward but not working. I did try compiling w/ just the ./configure and that works but the mcrypt does not appear after i complete the rest of your steps. So i’m not sure if i’m not seeing it b/c I’m not running the first part or something else. I have new macbook pro with the default php, apache, and I compiled mysql myself.
Thanks,
March 5th, 2009 at 7:36 am
@Andris/Dom – Cool!
@ Jason – 1) Do you have Xcode in place? 2) You are in the libmcrypt-2.5.8 directory, right? 3) Are you adding ‘gcc’ to the first configure string?
March 7th, 2009 at 1:33 pm
Michael
Yes I am doing those three things. I know i gcc install b/c i compiled mysql prior to this. The command i’m running is
sudo gcc MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ LDFLAGS=’-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ ./configure –disable-dependency-tracking
and it says No such file or directory for each line in the above command. This is weird. Any thoughts? Thanks.
March 7th, 2009 at 1:39 pm
I ran this command MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ LDFLAGS=’-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ gcc ./configure –disable-dependency-tracking and now I am getting
ld warning: in ./configure, file is not of required architecture
Undefined symbols:
“_main”, referenced from:
start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
March 7th, 2009 at 2:23 pm
Jason – Please note that what I posted above is exactly how I did it – no mods. Try it just as it is displayed above – without adding ‘gcc’ anywhere. And you are probably going to need to unpack clean source too.
March 10th, 2009 at 1:52 pm
Many Thanks!
March 12th, 2009 at 6:15 am
Great run-through. I haven’t set up a sleek php/mysql machine since 10.3. The scenery has changed a bit. It’s all up and running for me now, but I am left wondering how it is now integrated into the OS. What does the above procedure actually do? (My guess: compile a non-apple-ified PHP, compile mcrypt, create a PHP-compatible .so extension for mcrypt, nudge Apache to see the new PHP?)
What effects will the above have on OS X Server? With macports, for example, installing mcrypt throws everything into /opt. Doing it this way, are standard “Software Update”s going to kill this PHP since the OS already “had its own”? If I use other PHP extensions, will they be in a different extension dir, the loading of which is now commented out? (the article says do not uncomment, but mine already was uncommented so I added the semicolon). Anything else we should keep in mind going forward? — Thanks again; it’s great to be up and running so quickly.
March 30th, 2009 at 12:54 pm
I stumbled a little with this, but it worked in the end. I uncommented the line “extension=php_mcrypt.dll”, and changed “dll” to “so” but forgot to remove “php_”.
March 30th, 2009 at 2:29 pm
@Joel – Sorry I haven’t gotten back to you sooner. On Server I do not know – this process was for the desktop version only, something I only got around to pointing about when I did the post on setting up SSL. Also – I don’t think standard updates will kill this, unless the update overwrites all config files – I’ve never seen that happen before, even when running Entropy PHP on Tiger. And yes, all the extensions should be in separate directories – check under your php directory source to see the standard stuff that comes with the 5.2.6 package – you need separate extension references for each ‘plug-in’ (I’m 90% sure on that).
@Beware – glad it all worked out!
April 5th, 2009 at 11:07 am
On a PPC, G5 iMac, running 10.5.6
Getting “differing signedness” errors when making libmcrypt-2.5.8:
Ends badly with: aes_test.c:200: warning: pointer targets in assignment differ in signedness
& then cannot make install.
Php-5.2.6 also fails. I’ve downloaded…XCode 3.1.2, with no discernible difference. Also Tried with Php-5.2.9…similar results:
make: *** [sapi/cgi/php-cgi] Error 1
make: *** Waiting for unfinished jobs….
ld: duplicate symbol _yytext in Zend/zend_ini_scanner.o and Zend/zend_language_scanner.o for architecture ppc64
collect2: ld returned 1 exit status
lipo: can’t open input file: /var/tmp//ccK6SDD4.out (No such file or directory)
make: *** [sapi/cli/php] Error 1
Have tried this about 15 different ways. Guess I’m giving up.
Daniel
April 5th, 2009 at 11:25 am
Daniel – That libmcrypt source is architecture independent, so I’m fairly certain that is not the issue. I don’t have a PPC-based machine to try this on, so let’s hope someone cruises by and can help us with this problem.
ANYONE WHO HAS HAD SUCCESS WITH COMPILING LIBMCRYPT ON POWERPC, ALL THOUGHTS ARE APPRECIATED.
April 20th, 2009 at 8:22 pm
I had the same php issues as Daniel and I’m on a brand new MacBook Pro running Leopard 10.5.6. Tried php-5.2.9 and it ends with the same [sapi/cgi/php-cgi] Error 1
Haven’t tried sudo make install yet, figured it might hose the existing php.
April 20th, 2009 at 8:23 pm
Just ran sudo make install and here’s the last few lines of errors:
ld: duplicate symbol _yytext in Zend/zend_ini_scanner.o and Zend/zend_language_scanner.o for architecture x86_64
collect2: ld returned 1 exit status
ld: duplicate symbol _yytext in Zend/zend_ini_scanner.o and Zend/zend_language_scanner.o for architecture i386
collect2: ld returned 1 exit status
ld: duplicate symbol _yytext in Zend/zend_ini_scanner.o and Zend/zend_language_scanner.o for architecture ppc
collect2: ld returned 1 exit status
ld: duplicate symbol _yytext in Zend/zend_ini_scanner.o and Zend/zend_language_scanner.o for architecture ppc64
collect2: ld returned 1 exit status
lipo: can’t open input file: /var/tmp//ccCTDo9s.out (No such file or directory)
make: *** [sapi/cgi/php-cgi] Error 1
April 21st, 2009 at 8:28 am
Randy – what about 5.2.6? And what are your other version #s? Maybe Apple updates have done something in the last few months that effects the process…
April 21st, 2009 at 10:52 am
I’ve tried 5.2.8 and just now 5.2.6 without success. If I do it exactly as you have typed in your tutorial, I get the following just after .configure runs:
=============================================
Thank you for using PHP.
Notice: Following unknown configure options were used:
–with-php-config=/Developer/SDKs/MacOSX10.5.sdk/usr/bin/php-config
Check ‘./configure –help’ for available options
=============================================
When I try to enter options that include the basics I need, I then get the “duplicate symbol _yytext…” errors.
I’ve verified that /Developer/SDKs/MacOSX10.5.sdk/usr/bin/php-config exists, but don’t know how to get it to work with .configure. Any thoughts?
April 21st, 2009 at 10:55 am
Forgot about the versions. The only other versions I know of are the built in Apache 2.2.9, Readline 5.2, Mysql 5.1.33 (all three are fat binaries with 4 archs included: i386, x86_64, ppc7400, ppc64)
April 21st, 2009 at 11:09 am
Randy – Ok, just want to make sure we have the version stuff correct first (‘m assuming you know what I’m about to say – just checking)…
PHP should already be on the laptop, and unless Apple updates changed it the version should be 5.2.6. Go into your /Library/WebServer/ directory, and copy the base Apache docs to an new directory and then clean out the old. Create a blank index.php file in the Documents directory, alone, and put this in the file…
< ?php phpinfo(); ?>Then start Apache and point your browser to that file. It’ll tell you the version of PHP already running.
You need the PHP source for the same version number, and I suspect that’ll be 5.2.6.
Also, you do have XCode installed, right?
April 21st, 2009 at 12:19 pm
Ha.. not so fast. At this point, enabling libphp5.so in httpd.conf kills apache. Won’t start up.
“…file found, but wrong architecture” on libphp5.so. Googling around tells me Apache is 64 bit, so I should either a)compile everything else the same. b)use lipo and suck out the 64bit arch’s from apache to force it to 32bit (lasts as long as I don’t do a software update). c)install a separate apache. I’d like to do #3, but all the tutorials seem to favor macports. I’ve used macports in the past and wanted to try and compile everything from source this time around. If I have to, macports it is.
I’m running XCode 3.1.3
Prior to reading your tutorial, I knew 5.2.6 was on the machine, but decided to try the latest since I usually only do this when setting up a new machine. The first time I built php-5.2.9 (not your way) it worked, but with defaults since I hadn’t specified any options. After installing phpmyadmin, it told me mcrypt was missing, which led me to your page. I tried your way again on 5.2.9 but got the “Following unknown configure options were used” error and I figured it never read the php-config file from the SDK path, so it must also be a default configuration. I then resorted to trying to combine the settings you put ahead of ./configure with some options from other install pages and no matter what I put, even if just the *FLAGS options and ./configure, I get duplicate _yytext errors. I’ve been up for quite a while and am a bit punchy at this point.
If I wanted to try re-compiling using the Developer SDK’s php-config file, since –with-php-config isn’t a valid option, would I try –with-config-file-path= (say’s that’s for php.ini, not php-config) or –with-config-file-scan-dir= (say’s for config files, but not specifically php.ini)?
In liu of getting it to recognize /php-config, here’s the latest recipe I’ve been nursing, without success:
MACOSX_DEPLOYMENT_TARGET=10.5 \
CFLAGS=”-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64″ \
CXXFLAGS=”-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64″ \
LDFLAGS=”-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64″ \
./configure \
–prefix=/usr/local/php5 \
–mandir=/usr/share/man \
–infodir=/usr/share/info \
–sysconfdir=/etc \
–with-zlib \
–with-zlib-dir=/usr \
–with-openssl \
–enable-exif \
–enable-ftp \
–enable-mbstring \
–with-mcrypt \
–enable-mbregex \
–enable-sockets \
–with-mysql=/usr/local/mysql \
–with-pdo-mysql=/usr/local/mysql \
–with-mysqli=/usr/local/mysql/bin/mysql_config \
–with-apxs2=/usr/sbin/apxs
April 21st, 2009 at 12:37 pm
R –
That I do not know, and when I started manipulating the configure strings outside of the researched stuff above I got nowhere. I was loath to recompile PHP from the start, which is why I went the DSO route. I’ve always had trouble with the PHP, and prior to this Leopard round always used Marc’s entropy.ch packages (http://www.entropy.ch/software/macosx/php/).
But…I did have the same problem with the .so file crashing Apache, that is before I completely deleted all the source, unzipped new source, and tried again.
May 15th, 2009 at 2:54 pm
Works under 10.5.7 with php-5.2.9-source and XCode 3.1.2. Thanks a lot.
May 20th, 2009 at 4:12 am
Am trying this again after upgrading to 10.5.7 (PPC iMac 1.8GHz). The make -j6 (php-5.2.9 & mcryptlib-2.5.8) ends with this error:
lipo: can’t open input file: /var/folders/Uj/UjubtB0bFpO0Z-wLiC7B9E+++TM/-Tmp-//ccmsG1mx.out (No such file or directory)
make: *** [sapi/cli/php] Error 1
make: *** Waiting for unfinished jobs….
ld: duplicate symbol _yytext in Zend/zend_ini_scanner.o and Zend/zend_language_scanner.o for architecture ppc64
collect2: ld returned 1 exit status
lipo: can’t open input file: /var/folders/Uj/UjubtB0bFpO0Z-wLiC7B9E+++TM/-Tmp-//cctV1Iuz.out (No such file or directory)
make: *** [sapi/cgi/php-cgi] Error 1
Daniel
May 20th, 2009 at 7:24 am
Daniel – I hate to ask this, but have you tried pinging the Apple developer forums?
Also curious – I’ve upgraded to 10.5.7 but the PHP version is 5.2.8 (and mcrypt is still working fine). You said you are using php-5.2.9 source code…did you do your own compilation of PHP?
May 23rd, 2009 at 2:56 pm
Hi there,
I can’t seem to get mcrypt working on my machine following this post — any help really appreciated
I’m running OS X 10.5.7 w/PHP 5.2.8 and Xcode 3.1.2 installed.
0) downloaded php-5.2.8 from php.net and libmcrypt-2.5.8, unzipped and placed both directories in “SourceCache” on my desktop.
1) opened Terminal, cd’d me into the libmcrypt-2.5.8 directory and ran “MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ LDFLAGS=’-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ ./configure –disable-dependency-tracking”. No errors spotted.
2) then ran “make -j6″ and “sudo make install” — seemed to have done fine.
3) went into php-5.2.6/ext/mcrypt and ran all three commands — again, no errors spotted.
4) And, at last, I opened php.ini and:
4.1) I noticed extension_dir = “./” was in use (not commented out). Following this post I commented it out (ref. “but do not remove the ; from in front of ;extension_dir = “./”")
4.2) enable_dl = On was already correct, so no need to change it.
4.3) Found “; Dynamic Extensions ;” and replaced “;extension=php_mcrypt.dll” with “extension=mcrypt.do”.
Rebooted, looked at phpinfo.php but no mcrypt…
May 23rd, 2009 at 2:59 pm
OK, I’m about to jump out the window. I’d written mcrypt.do instead of mcrypt.so.
I guess I just have to say thanks for a great tutorial
May 24th, 2009 at 7:17 am
All’s well that ends well, Espen. Glad this helped.
May 25th, 2009 at 12:28 am
Great post! Your instructions are detailed and — for my setup at least — right on the money.
On a different note, I discovered that after entering my name into your comment form, tab took me to the search field rather than the e-mail field. I had a quick look at the page source and my suspicion was confirmed: you have conflicting tabindexes. My advice is to remove tabindexes from your site altogether. Reading this enlightening article entitled “Too much accessibility” may persuade you to do so: http://www.rnib.org.uk/wacblog/articles/too-much-accessibility/too-much-accessibility-tabindex/.
If you decide to keep the tabindexes for any reason, at least ensure that you’re not using the same tabindex more than once on a page. You could change the comment form from 1-2-3 to 3-4-5 (or 101-102-103).
May 25th, 2009 at 7:01 am
Appreciate that David – I never noticed it before. And I did take the advice…thanks!
May 25th, 2009 at 7:12 am
It’s working beautifully now. Nice one!
May 26th, 2009 at 10:11 am
thank you so much!
June 4th, 2009 at 5:10 pm
its a little bit tricky. i’m gonna try it soon ^_^
thanks for the guide.
June 18th, 2009 at 1:27 pm
Randy:
I was having the same issue with the following error:
Notice: Following unknown configure options were used:
–with-php-config=/Developer/SDKs/MacOSX10.5.sdk/usr/bin/php-config
Check ‘./configure –help’ for available options
I discovered that I was not running configure inside ext/mcrypt and was instead running it in the php-5.2.8 source root. ./configure is supposed to be run from within ext/mcrypt or it fails as we’re seeing.
My new MBP w/ 10.5.7 came with PHP 5.2.8 pre-installed and Xcode 3.1.2. I also had to comment out the ;extension_dir = “./” line in order to get mycrypt working.
June 28th, 2009 at 2:17 am
I had to add the ; in front of ;extension_dir = “./” before this worked. (It wasn’t there already.)
July 3rd, 2009 at 8:24 pm
Great work!!! Thanks a lot!
July 15th, 2009 at 10:49 pm
Excellent!!!
July 23rd, 2009 at 6:36 pm
It worked in the end
Although I got loads of ‘pointer signedness’ errors during the making of libmcrypt. Has anyone got a clue what’s that about?
Also I removed the ppc architectures from both of the configurations as I’m using them only on my MBP. Seems to work so far.
And as mentioned earlier already I also had to re-comment the extension_dir option.
Running OSX 10.5.7, php 5.2.8, Xcode 3.1.3
Recommendation: maybe it would be a good idea to put the folder names on separate lines as I missed the ‘ext/mcrypt’ bit initially exactly the same way as Jory did a few posts back.
Otherwise great work figuring all this out!
August 5th, 2009 at 3:23 am
I followed the guide to the letter many times but I still can’t get phpinfo to recognize mcrypt. There are no error messages post install.
Steps:
Extract the 2 source folders
Configure and Install libmcrypt
Run the following configuration for php-5.3.0/ext/mcrypt:
MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ LDFLAGS=’-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ ./configure –with-php-config=/Developer/SDKs/MacOSX10.5.sdk/usr/bin/php-config
There was no extension_dir=”./” in my php.ini file (but I added one in and commented it out for good measure). I added extension=mcrypt.so.
I restart Apache and check phpinfo. Nothing about mcrypt is there and phpmyAdmin is still throwing the mcrypt error.
I’m running OS X 10.5.7 and I have XCode 3.1.2. Anyone know what I’m doing wrong?
August 5th, 2009 at 5:56 am
You compiled your own PHP? What version of php does the phpinfo command say?
August 5th, 2009 at 10:18 pm
I figured out the issue. It appears that I’m an idiot and had the focus window on Terminal when I executed the search for extension_dir. There was an entry in the php.ini file that wasn’t commented out which I missed. Everything working as it should now =). Excellent guide.
August 12th, 2009 at 1:45 pm
Michael great post .. but after punching in the ./configure statement exactly as above it fails:
…
…
checking for libmcrypt-config… no
checking for libmcrypt – version >= 2.5.0… no
*** 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
Any ideas? Thanks in advance.
August 12th, 2009 at 3:35 pm
Mike – I’m not sure what the problem is there, other than it seems some files might be missing. I can only suggest cleaning out the source directory and unwrapping a new set of files – I had some problems early on with various errors, and that process wound up working for me. Wish I could be of more precise help.
August 20th, 2009 at 5:58 pm
Hello Michael,
I wanted to say, Thanks so much for providing this: the only fix on the web that I could find with hours of poring over bash.
I was wondering,
Do you know of any good resources to learn about the huge commands that are in this article?
Things like this:
MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ LDFLAGS=’-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ ./configure –with-php-config=/Developer/SDKs/MacOSX10.5.sdk/usr/bin/php-config
Is this standard Unix manipulation?
August 25th, 2009 at 7:42 pm
Thanks, this really helped!
August 29th, 2009 at 5:31 pm
Works well on 10.6 with the following adjustments : remove all G4 and G5 arch params (-arch ppcXXX), the compiler provided with 10.6 does not support these architectures anymore. Replace 10.5 with 10.6 (especially the one in the SDK path).
August 30th, 2009 at 2:31 pm
I had the same problem that Mike had.
Mike, you could fix it?
Thanks!
August 30th, 2009 at 2:39 pm
I don’t really know what happens, but I suggest to double-check you downloaded libmcrypt and not mcrypt.
August 30th, 2009 at 4:02 pm
Im sorry, where can I get libmcrypt? I get that error with Source Forge mcrypt
http://sourceforge.net/projects/mcrypt/
August 30th, 2009 at 4:48 pm
@Chuck – I’ll look into it when I get the chance, but as credited in the tutorial I took lots of pieces/parts from others to get this right.
@Yvan – Thanks very very much. You prompted me to run out and get Snow Leopard for a test. Once I’m done I’ll update everyone (and of course give credit where credit is due).
Kike – There is a link at the beginning of the post for libmcrypt. I just checked it, and it is still correct as far as links go – you want libmcrypt 2.5.8, not mcrypt.
August 30th, 2009 at 4:57 pm
Thanks!… But, I have a question. Theres a way to compile libmcrypt only without complile PHP?
I ask this because of PHPIZE… is that necesary? Im sorry, but Im not familiarized with PHPIZE…
Thanks
August 30th, 2009 at 9:23 pm
You are not compiling PHP here – just mcrypt specifically for use with PHP.
August 31st, 2009 at 9:40 am
Thanks.
But Im trying but, after compilling… mcrypt.so says: Mach-O bundle i386
And it doesnt show in phpinfo();
Does anyone has the file already compilled to send me?
Please?
August 31st, 2009 at 10:35 am
I’m not sure what that means, but I am sure that the file compiled on someone else’s machine isn’t going to work on yours unless the entire configuration is precisely the same.
I’ve followed the discussion, and think your best bet is to start from scratch and follow the directions to the letter. I tried lots of shortcuts before getting it done exactly as prescribed above, and don’t have a way to duplicate problems without screwing up a stable install.
August 31st, 2009 at 10:57 am
Yes, you’re right.. anyway when I run
MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ LDFLAGS=’-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ ./configure –with-php-config=/Developer/SDKs/MacOSX10.5.sdk/usr/bin/php-config
It returns …
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.
August 31st, 2009 at 12:39 pm
Looks like you don’t have libmcrypt installed. This process only works in the exact way described above, using the source I linked to. In this case it’s libmcrypt 2.5.8 yet your error says 2.5.6. Don’t know what else to suggest.
August 31st, 2009 at 12:45 pm
August 31st, 2009 at 1:37 pm
You’re SO GREAT!… I was getting that error because of PHP Version.
THANKS! You’re great!
September 4th, 2009 at 5:57 am
Thanks Michael. This was very helpful. This worked as-is on OSX 10.5.6 (MacBook). For 10.5.8, it turns out that Apple started shipping PHP 5.2.8 without mcrypt or gd (your other post) enabled. But, happily I didn’t have to rebuild php for 10.5.8. All I needed to do was to build and install just the extension as per your post from within Apple’s patched php 5.2.8 source tarball from http://opensource.apple.com/source/apache_mod_php/apache_mod_php-44.2/. This was a good thing in another sense because the php 5.2.8 distribution from php.net has a few build issues on OSX 10.5.8 (see php bug# 44462 and its follow-on)
September 4th, 2009 at 8:28 am
hey there,
I’m following your instructions
I’m in /SourceCache running the /usr/bin/phpize line, and I get this:
Cannot find config.m4.
Make sure that you run ‘/usr/bin/phpize’ in the top level source directory of the module
any idea’s?
September 5th, 2009 at 2:04 pm
Is phpize in that directory on your install?
September 6th, 2009 at 3:59 am
yes it is, i see it there
September 6th, 2009 at 1:04 pm
Hmm…you’re in /SourceCache, or down two levels in the PHP mcrypt source directory?
September 6th, 2009 at 1:41 pm
hey Michael, i still dont know what i did wrong but I’ve found a great solution to my problem:
i disabled the default install of php5 in /private/etc/apache2/httpd.conf and installed a new entropy Leopard package for php5.3-03. it solves all my problems, it includes mcrypt but also GD version 2.+ – see here: http://www.entropy.ch/software/macosx/php/#install
sorry i never finished your tutorial but i appreciated very much that you took the time to reply, thanks and all the best!
September 6th, 2009 at 2:23 pm
Hi,
Thanks for this hint.
I’m a greenhorn-switcher and I’tried a lot of days to add mcrpyt.
I’m using PHP-5.3.0 and Snow Leopard.
So I’ve modified some values in the Compiler variables, and what should I say …It works !!
Thank you, I will link this tipp to my Blog.
regards
September 14th, 2009 at 11:50 pm
hi
do you have an update for 10.6/mcrypt 2.6.8 and php 5.3.0/xcode 3.2 ?
i got an error, so changed the deployment target to 10.6 but i have no clue what these flags do.
MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ LDFLAGS=’-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64′ ./configure –disable-dependency-tracking
checking build system type… i386-apple-darwin10.0.0
checking host system type… i386-apple-darwin10.0.0
checking target system type… i386-apple-darwin10.0.0
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… ./install-sh -c -d
checking for gawk… no
checking for mawk… no
checking for nawk… no
checking for awk… awk
checking whether make sets $(MAKE)… yes
checking for style of include used by make… GNU
checking for gcc… gcc
checking for C compiler default output file name…
configure: error: C compiler cannot create executables
See `config.log’ for more details.
September 15th, 2009 at 8:14 am
You have to remove every occurence of -arch ppc7400 -arch ppc64 as these architextures are unsupported in Snow Leaopard.
October 21st, 2009 at 3:41 pm
Not sure if already mentioned, you have to add the complete path to mcrypt.so in the php.ini update (extension=/usr/lib/php/extensions/no-debug-non-zts-20060613/mcrypt.so). At least I had to to make it work.
Thanks for the info!
October 24th, 2009 at 10:15 am
Nice, everything worked as you pointed. Great instructions.
Thanks
November 3rd, 2009 at 3:14 pm
I too want to add my thanks to your instructions. I usually do not post comments but I felt the importance after following teh instructions. Great job of explaining.
Cheers.
January 15th, 2010 at 9:41 am
Thank you for your tutorial but I’m still not able to install…
Get a “configure: error: Sorry, I was not able to diagnose which libmcrypt version you have installed.”
I read the thread that had a solution, but he really didn’t give an answer other than “PHP version”
help
January 15th, 2010 at 12:33 pm
Steve – Do you have libmcrypt installed?