Space Cat, Prince Among Thieves

Install PHP Mcrypt Extension in OS X

This is verified to work in Yosemite but should work at least in Mavericks if not older as well. Let me know if issues should arise.

These directions are for working with the native installation of PHP. Your results may vary if you are using a brew or otherwise installed version of PHP.

We meed install the required dependencies. If you are not already using Homebrew you will need it.

$ brew install autoconf pkg-config libmcrypt

You will also want to make sure you have PEAR installed; instructions can be found here but can be summarized as follows:

$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar

Next we will download the PHP source. Verify the exact version of PHP you are running.

$ php --version

This should output something along the lines of the following. The version is highlighted.

PHP 5.5.14 (cli) (built: Sep  9 2014 19:09:25) 
Copyright (c) 1997-2014 The PHP Group

Now we move into a working directory and download the source making sure to update the following for the version from above.

$ cd /tmp
$ mkdir memcached
$ curl -L http://php.net/get/php-{{version}}.tar.bz2/from/this/mirror > php.tar.bz2
$ open php.tar.bz2

Now we will compile and test the Mcrypt extension.

$ cd php-{{version}}/ext/mcrypt
$ phpize
$ ./configure
$ make
$ make test
$ sudo make install

If all that goes well finally we'll need to add the following to our php.ini - I usually add at it at the end of the file.

extension = mcrypt.so

You can verify your installation with the following:

$ php --info | grep mcrypt\\.

Lastly, depending on your setup now you may want to restart apache.

$ sudo apachectl restart

Read More / Comment »

Require a Remote Zip File with Composer

I previously showed you how to Load a Github Gist with Composer, but sometimes you need to install code that isn't isn't even in a public facing VCS. I for instance wanted to use a library only distributed by Zip. It's actually fairly easy! In your composer.json file, you simply add a repositories s…


Read More / Comment »

All Glory to __invoke

Lost in the shiny new features (see: namespaces and closures) PHP 5.3 also added the __invoke method. While not plainly apparent, it is secretly an amazingly useful 'magic method' . If you're not taking advantage of __invoke, you should be. Why? It provides a uniform execution points for objects th…


Read More / Comment »

Last.fm donatJ

Philip Glass - Mishima
Arca - Xen
CHVRCHES - The Bones of What You Believe
Andrew Hewitt - The Double (Original Soundtrack Album)
Kanye West - The College Dropout
Tycho - Awake
Agnes Obel - Aventine
Kyu Sakamoto - The Double (Original Soundtrack Album)
Bob Dylan - Blonde on Blonde

Flickr donatJ

STP80617
STP80616
STP81015
STP81006
STP81005
STP81004
STP80967
STP80961

Recent Comments

Thanks for making this it really helps me out a lot. I've been using this page for a while and it's helped me build many things. So once again thank you for mak…
Link

This has really helped me make class spheres using just the 2D circles. All I have a a suggestion is maybe make the little lines that are like a plus sign a lit…
Link

Thank you so much man!! I have been struggling with this for two weeks now. Thanks man!!
Link

Hi - many thanks for this extremely useful tool. I was wondering if there was a way to further differentiate device types: at the moment, a distinction is made …
Link

GREAT!!! Thank you!
Link

Tag Cloud