Installation method One:
- Installation of MCrypt via homebrew, successful installation
[Shell] Plain Text view copy code Brew Install MCrypt
MCrypt is a powerful cryptographic algorithm extension library that includes 22 of algorithms.
1: Download and unzip the mcrypt-2.6.8.tar.bz2. (2.6.8 is a version number, you can choose it yourself, but note that the following steps are consistent with the version number you downloaded.) )
2: Execute command on terminal (note the following commands need to install Xcode support):
CD ~/downloads/mcrypt-2.5.8./configure--disable-posix-threads--enable-staticmakesudo make install
3: Download and unzip the PHP source code, according to their own situation to choose the corresponding version. (Note the PHP version in the following command)
Execute command at Terminal: (see behind if error)
CD ~/downloads/php-5.5.14/ext/mcryptphpize./CONFIGUREMAKECD modulessudo cp mcrypt. so/usr/lib/php /extensions/no-debug-non-zts-20121212/
(CD modules appears after
Build complete.Don‘t forget to run ‘make test‘.
Indicates that the installation was successful. )
4: Open php.ini
sudo vi/etc/php.ini
Add the following code: (note no-debug-non-zts-20121212 version number, if not clear can go to/usr/lib/php/extensions/view)
Extension=/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so
* If the following error occurs with Phpize:
grep: /usr/include/php/main/php.h: No such file or directorygrep: /usr/include/php/Zend/zend_modules.h: No such file or directorygrep: /usr/include/php/Zend/zend_extensions.h: No such file or directoryConfiguring for:PHP Api Version:Zend Module Api No:Zend Extension Api No:Cannot find autoconf. Please check your autoconf installation and the$PHP_AUTOCONF environment variable. Then, rerun this script.
Indicates the need to install autoconf (install view later essays)
* If make appears the following error:
/ext/mcrypt/mcrypt.c:25:10: fatal error: ‘php.h‘ file not found
Execute the following command:
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include /usr/include*注意MacOSX10.10.sdk修改为自己系统的版本号*
Transferred from: http://segmentfault.com/a/1190000002395906
Ask MCrypt how to install PHP under Mac OS