I’m doing some work on a project that is using PHP, and have been working on setting up some continuous integration build scripts to make sure that we have a shot at catching errors before they make their way to production.

Recently some unit tests were added for the “forgot password” code, which uses the mcryp

t libraries which are not installed by default on Mac OSX, so I was seeing this error:

So some quick Google searches, and I found a couple of blogs with “how to” install the library (links at the end of this post), and proceeded to get this done.

First step was to download the mcrypt from SourceForge at http://sourceforge.net/project/showfiles.php?group_id=87941

Once I had the file, I opened a command prompt and ran:

Next I ran configure, setting the appropriate flags for my envirionment (note – I didn’t do this for the other configures, probably would have been a good idea):

This sets up the make file, so you can run the next two commands:

Next to make the PHP library, I needed the PHP source files, so I went out and grabbed PHP 5.3.15 (since that’s the version I have when I run php -version) by going to http://us3.php.net/get/php-5.3.15.tar.bz2/from/a/mirror. Note that you can simply change the version number in that URL to get the version you need.

Once I had that I did the following:

This of course gave me an error about autoconf not being installed:

From there I installed autoconf by doing the following:

Then back to the php mcrypt folder and reran the phpize step to and finish building:

Finally an edit to the php.ini file which was simply to add the extension:

And of course a quick restart of Apache and the extension shows up and I can run my unit tests successfully.

Related posts:



Enhanced by Zemanta