Why I hate mcrypt for Macs

Some things in life I probably will never understand. Take Mcrypt for example. This thing I have no idea why we need it, who built it, why they built it… but I do know I need it. Why? Because I was trying to get Laravel 4 running and it needs it to run.

With Macs, there is a bit of a strange thing going on. Macs come with PHP and Mysql installed but it is an older version. Most people use MAMP or something like it to make local development easier to get set up. I took the plunge to manually install php and mysql and it was kind of a long pain in the ‘server side’… if you know what I mean.

But I finally figured it out… don’t ask me how.

But now I am trying to work with this really cool thing called Laravel (and it just jumped from version 3 to 4 and stuff changed).

So mcrypt. I read this post and this post. But after reading both of those posts I still couldn’t get it to work.

But I started to think about it and came up with a solution. I already had installed PHP5 before but I don’t know if I screwed something up or what but mcrypt wasn’t there and I was getting errors. I followed the instructions on the second article I mentioned and it told me where and how to download mcrypt and php. I followed the instructions but my problem was I was working from the wrong php.ini file (this is the PHP config file and apparently I had multiple of them). The instructions in the second post gave me the right info (sudo cp mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20090626/). This is the .so file I need and just made with the Terminal via their instructions and this line copies the freshly made mcrypt.so file and moves it to the location in the extensions file inside a strangely named ‘no-debug’ folder.

I was following the instructions of the first post where it told me to change the info in php.ini. But I needed to change it in /etc/php.ini

And I made these two additions inside the [mcrypt] section:

extension_dir = “/usr/lib/php/extensions/no-debug-non-zts-20090626/”

I then restarted the server and it finally worked. I’m sorry for the confusing post. I’m sure it will make sense to no one but me, but it took me 2 hours to figure out and I don’t want to have to go through this again so it’s essentially a post for me. If it helps you, great.

Leave a Reply

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