Adding mcrypt Support to PHP on CoolStack 1.3.1

por | 6 diciembre, 2008

Antes instalar: pkg-get -i autoconf

Link: Adding mcrypt Support to PHP on CoolStack 1.3.1

One of the things that CoolStack is missing however is the mcrypt extension, which is used in a number of PHP applications, for example PHPMyAdmin. I was surprised this was missed out, as so many others are included. However it’s not too hard to add this ourself. This example is for CoolStack 1.3.1, but assuming the stack doesn’t change too much, the principles should be the same.

Compiling libmcrypt

Head on over to and download the latest libmcrypt source. You’ll need a healthy development environment, which I’m hoping to blog about in a future post (Hint: Grab Sun Studio 11 and put /opt/SUNWspro/bin at the front of your path).

You’ll want to choose a sensible place to install libmcrypt to – since I was producing a package for deployment to other servers, I chose “/opt/libs/libmcrypt”, but where you place this is up to you – “/opt/coolstack” is another suitable PREFIX path.

Let’s now compile and install libmcrypt (Using cc rather than gcc):

export CC=cc
./configure --prefix=/opt/libs/libmcrypt --enable-dynamic-loading \
make install

Et Voilà! You now have libmcrypt installed. If your compiler barfs, post a printout of what you get in the comments and I’ll assist if I can.

Compiling the php mcrypt extension

Assuming you have already downloaded, installed and configured CoolStack, all we need to do is fetch two CoolStack source packages. Nip on over to, click the link to download, and choose “Source” as the Platform.

Download and install CSKruntime_1.3.1_Src.pkg.bz2 and CSKamp_1.3.1_Src.pkg.bz2 – this should place files under /opt/coolstack/src. Now lets compile the mcrypt extension:

cd /opt/coolstack/src/php5/
cd php-5.2.6/ext/mcrypt
./configure --with-php-config=/opt/coolstack/php5/bin/php-config \
make install

You can check to make sure the resulting file is safe to use by doing:

ldd /opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613/

This should not show any “(file not found)” errors.

Finally, add to /opt/coolstack/php5/lib/php.ini. Restart Apache (svcadm restart http) – phpinfo(); in a php file should now show a happy mcrypt installation 🙂