Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I link mcrypt?

I am trying to install mcrypt for use on my local machines dev environment. I need to this to install Magento.

I used this answer to install mcrypt, but get the following error:

$ brew link mcrypt
Linking /usr/local/Cellar/mcrypt/2.5.8... Warning: Could not link mcrypt. Unlinking...

Error: Could not symlink file: /usr/local/Cellar/mcrypt/2.5.8/include/mutils/mcrypt.h
Target /usr/local/include/mutils/mcrypt.h already exists. You may need to delete it.
To force the link and delete this file, do:
  brew link --overwrite formula_name

To list all files that would be deleted:
  brew link --overwrite --dry-run formula_name

Trying to overwrite the links as suggested in not allowed.

$ brew link --overwrite mcrypt
Linking /usr/local/Cellar/mcrypt/2.5.8... Warning: Could not link mcrypt. Unlinking...

Error: Permission denied - /usr/local/include/mutils/mcrypt.h

Prepending this command with "sudo" does not fix this issue as that is also not allowed.

Running php -m doesn't show mcrypt as an installed module, and also throws the following error:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20100525/mcrypt.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20100525/mcrypt.so, 9): image not found in Unknown on line 0 

This all seems to be related to the fact that I cannot link this, I just can't seem to solve this issue though. Has anyone encountered this? Thanks for any help you can provide.

like image 498
Thomas Avatar asked Sep 12 '26 11:09

Thomas


2 Answers

Thomas, from what I can see above it looks like you're trying to use Homebrew to install the mcrypt package to your system, but mcrypt has already been installed by another package management system (or may ship by default in your version of OS X — I don't keep up on these things)

Since mcrypt is already installed on your *nix system, what you need to do is install the PHP extension for mycrypt, or install a version of PHP that support mcrypt out of the box.

My usual approch to this is to use the hp-osx.liip.ch package (which seems to be the successor to Marc Liyanage's old entropy.ch package). This installs a stand alone version of PHP as a binary, and should have the libraries you need to run Magento.

like image 197
Alan Storm Avatar answered Sep 15 '26 02:09

Alan Storm


I actually just ran into this problem for the second time. Couldn't remember how I solved it the first time. What worked for me this time was I actually deleted the mcrypt.h file under mutils. Then when I ran brew link --overwrite mcrypt it successfully linked. Then I ran brew install php53-mcrypt and that seemed to do the trick. Also restart the server.

Wouldn't be surprised if this doesn't work for everyone but it worked for me.

like image 44
Jeffery Mills Avatar answered Sep 15 '26 00:09

Jeffery Mills



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!