MCrypt is a file encryption method using secure techniques to exchange data. It is required for some web apps for example Magento, the shopping cart software or a PHP framework likelaravel. This tutorial have been tested in OSX 10.10 Yosemite.
This are really for users with the version of PHP that shipped with OSX Yosemite which are version 5.5.14. Other downloadable AMP stacks already has mcrypt baked in.
Command Line Tools
First up you'll need the OSX 10.10 version of Command line Tools which you can download via the Apple available updates In the APP store.
Run in the Terminal
Xcode-select--install
Getting it on OS X Yosemite 10.10
This tutorial works mostly in the Terminal, launch it from/applications/utilities, change directory (CDS) to the home Acco UNT and make a directory so you'll work in, call it MCrypt
CD ~; mkdir MCrypt; CD MCrypt
Get Libmcrypt 2.5.8 from Sourceforge, this is direct download link.
Get the PHP code in a tar.gz or. bz2 format-(version 5.5.14 is the one, currently ships with OSX 10.10)
Move both of these files, downloaded into your working directory–mcrypt in this instance, and go back to Termina L
CD ~/mcrypt
Expand both files via the command line or just double click them in the Finder:
TAR-ZXVF libmcrypt-2.5.8.tar.gz
TAR-ZXVF php-5.5.9.tar.gz
Remove The Compressed archives
RM *.gz
Any errors in the command line including C + + and g++ mostly is due to the command line tools missing.
Configuring Libmcryptchange directory into Libmcrypt
CD libmcrypt-2.5.8
Libmcrypt needs to be configured, enter
./configure
Make
sudo make install
With the Libmcrypt configured and libraries now installed, time for to make the mcrypt extension.
Install Autoconf
Install autoconf –some more Terminal heavy lifting:
CD ~/mcrypt
Curl-o http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
Tar Xvfz autoconf-latest.tar.gz
CD autoconf-2.69/
./configure
Make
sudo make install
Compile mcrypt php Extension
Cd.. /php-5.5.9/ext/mcrypt/
/usr/bin/phpize
Output should is similar to:
Configuring for:
PHP Api version:20121113
Zend Module Api no:20121212
Zend Extension Api no:220121212
./configure
Make
sudo make install
The result of this should is similar to:
Installing Shared extensions:/usr/lib/php/extensions/no-debug-non-zts-20121212/
Enabling mcrypt.so PHP Extension
Open/etc/php.ini and add the line below at the end
Extension=mcrypt.so
If There is no php.ini file and then you need to make one from Php.ini.default in the same location like so:
sudo cp/etc/php.ini.default/etc/php.ini
and allow write capability
sudo chmod u+w/etc/php.ini
Then add the line as above in your favourite text editor:
sudo nano/etc/php.ini
Or
sudo vi/etc/php.ini
and add in the line:
Extension=mcrypt.so
Restart Apache
sudo apachectl restart
That's it, create a PHP page with the function phpinfo (); To see if it loaded correctly.
If it didn ' t load need to declare the extensions directory In/etc/php.ini
Extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20100525/"
Hopefully it wasn ' t too much of a nightmare ...
tales-from-the-mcrypt-yosemite-osx-php
Transferred from: http://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-10-yosemite-development-server/
Install mcrypt for PHP in Mac OSX 10.10 Yosemite for a development Server