8

I've updated my Mac OS X to Yosemite, but doing that I over write all my dev environment. So now, to run Laravel 4 on my local apache I need to install the Mcrypt extension, but everything that i've tried i fail. Even the steps that have worked on OS X Mavericks (10.9)

Anybody has the same issue? Thanks in advance.

Cheers

Anubz
  • 182
  • 1
  • 2
  • 9
  • 2
    Mac OS X 10.10 is probably too new for a compatible complied module to be out there yet. You maybe stuck compiling the module by hand... – Steven V Jun 10 '14 at 14:11
  • Another option would be to use Laravel Homestead to create a virtual development environment - http://laravel.com/docs/homestead?version=4.2 - if VirtualBox runs on Yosemite that is – glendaviesnz Jun 11 '14 at 03:25
  • You will have to compile it in using homebrew or similar: https://lastzero.net/2013/08/howto-install-php-5-5-and-phpunit-on-os-x-via-homebrew/ – Jannie Theunissen Jul 11 '14 at 12:32
  • If you don't mind updating also your php you cant try the automated script here http://php-osx.liip.ch/ It installs the latest php with the most common extensions without conflicting. – ricardgf Oct 30 '14 at 08:44

4 Answers4

8

I just installed it right now on my Mavericks installation using homebrew and it worked surprisingly well. Can't say whether or not it will work so well on Yosemite but worth a shot..

Homebrew

brew install autoconf
brew install mcrypt

Macports

  1. Check PHP version

    php -v
    
  2. Update Macports

    sudo port -v selfupdate
    
  3. Download & install the appropriate version..

    sudo port install php55-mcrypt
    

    now dummy proof it..

  4. Find where Macports put the file mcrypt.so and copy it to all instances of /php/extensions/no-debug-... folder. If you have that directory structure in multiple places, copy it to all of them. So every php/extensions/no-debug.. folder on your computer has a copy of mcrypt.so

    sudo cp /opt/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20090626/
    
  5. Determine where your php.ini file is and make sure it's the one your actually using because you may have this file in more than 1 place. Do this to all php.ini files you find..

    Within that file find and uncomment the following line. If it's commented out, uncomment it. If it's not in the file at all, add it. In my default php.ini file I found this on line 536:

    extension=mcrypt.so
    

Compile

  1. Download mcrypt

    curl -O http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
    
  2. Uncompress it

    tar -zxvf libmcrypt-2.5.8.tar.gz
    
  3. Configure, build, and install

    ./configure && make && sudo make install
    
  4. Download Autoconf

    curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
    
  5. Uncompress it

    tar xvfz autoconf-latest.tar.gz
    
  6. Configure, build, and install

    ./configure && make && sudo make install
    

Apache

Regardless which method you used to install it. You should always restart Apache when your done.

  1. Restart Apache

    sudo apachectl restart
    
davidcondrey
  • 34,416
  • 17
  • 114
  • 136
2

I just did these and it installed. MAMP etc. is not installed.

brew tap josegonzalez/homebrew-php
brew install php55-mcrypt

And weirdly, I had to reinstall to make it install properly.

brew reinstall php55-mcrypt

However, this also re-installed PHP5.5 from source, but no matter, all is working fine on my end.

Arda
  • 6,756
  • 3
  • 47
  • 67
1

I had the same problem. But, I'm using MAMP for my local development. So, I just needed to symlink the php file over to MAMP's version and all is working.

If using homebrew, try reinstalling or relinking your php install.

I'm sure I can help you get back up and working, so just let me know if that doesn't help.

TheTC
  • 677
  • 9
  • 19
  • I have the same problem of installing mcrypt extension. my homebrew is broken. Do I have to install brew again? (or may be just fix it? ) – Chandan Gupta Oct 17 '14 at 18:38
  • Well I ended up removing MAMP and using Vagrant for local development. That makes it easier to use homebrew for local PHP installs. – TheTC Oct 18 '14 at 19:24
  • Are you using MAMP for local development? If so ... you will just need to backup the current php executable. Then symlink MAMP's php executable into the same folder. – TheTC Oct 18 '14 at 19:26
1

First Install libtool from homebrew, which is a dependency in 10.10 Yosemite

brew reinstall libtool --universal && brew unlink libtool && brew link libtool

Then CD to your php directory

cd /usr/local/php5

And into your php.d directory

cd php.d

Then finally do a quick ls to see which extensions you are using:

ls -l

If you see duplicate entries containing "mcrypt" you will need to open one of them up, and comment out the line:

extension=mcrypt.so

to

;;extension=mcrypt.so

But only in one of them. For me it was mcrypt.ini. So..

sudo nano mcrypt.ini

added the line and done!