How to install mcrypt extension on mac os x yosemi

2020-02-26 01:14发布

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

4条回答
Animai°情兽
2楼-- · 2020-02-26 01:29

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!

查看更多
虎瘦雄心在
3楼-- · 2020-02-26 01:32

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.

查看更多
走好不送
4楼-- · 2020-02-26 01:46

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.

查看更多
做自己的国王
5楼-- · 2020-02-26 01:47

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
    
查看更多
登录 后发表回答