I am trying to install the mcrypt extension for PHP on my mac.
I used the homebrew command to install it
brew install php53-mcrypt
This gives me a message saying that it is already installed: php53-mcrypt-5.3.26 already installed
However, when I run the command php -m
, I do not see mcrypt in the list (I have restarted the terminal).
Edit 1: Adding mcrypt section of php.ini.default
In the php.ini.default file, this is section I have regarding mcrypt
[mcrypt]
; For more information about mcrypt settings see http://php.net/mcrypt-module-open
; Directory where to load mcrypt algorithms
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
;mcrypt.algorithms_dir=
; Directory where to load mcrypt modes
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
;mcrypt.modes_dir=
Determine if the mcrypt extension is loaded in any of the following ways: Set up a phpinfo. php file in the web server's root directory and examine the output in a web browser. Run the following command: $ php -r "phpinfo();" | grep mcrypt.
What is mcrypt? The mcrypt extension is a replacement for the UNIX crypt command. These commands serve as a means to encrypt files on UNIX and Linux systems. The php-mcrypt extension serves as an interface between PHP and mcrypt.
You can install Mcrypt from the PHP Source Tree as a module if you choose. Enable the module by adding: 'extension=mcrypt.so' to PHP. ini. Done!
ext/mcrypt ¶The mcrypt extension has been abandonware for nearly a decade now, and was also fairly complex to use. It has therefore been deprecated in favour of OpenSSL, where it will be removed from the core and into PECL in PHP 7.2.
Fisrt, find out where is the php.ini
:
php -i | grep php.ini
Then you will see something like these:
Configuration File (php.ini) Path => /usr/local/php/etc
Loaded Configuration File => /usr/local/etc/php54/php.ini
Open the Configuration File:
vim /usr/local/etc/php54/php.ini
search this file and check if you have something like this:
extension=mcrypt.so
copy mcrypt.so
to extension_dir
which is indicated also in php.ini.
or set mcrypt.modes_dir
mcrypt.modes_dir=/usr/lib/libmcrypt.so
Updated guide as of Mac Mavericks:
http://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-9-mavericks-development-server/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With