How to Install mcrypt for php on Mac OSX Lion 10.8 & 10.7 Development Server
来源:互联网 发布:视频录像软件 编辑:程序博客网 时间:2024/04/28 10:01
How to Install mcrypt for php on Mac OSX Lion 10.8 & 10.7 Development Server
The mcrypt extension is missing. Please check your PHP configuration.
The above error appears after you successfully get phpMyAdmin up and running on OS X, generally you don’t have to worry about it, you only need to address the error if you are going to use a web application that requires it, for exampleMagento, the shopping cart software.
mcrypt is a file encryption method using secure techniques to exchange data. This has been tested in 10.7 Lion and 10.8 Mountain Lion
Xcode
Get Xcode from the Apple app store, free download version, then install it from the /Applications folder it will be called ‘Install Xcode’ or just Xcode.app. You need this to use the compilers to compile the source code that you will download.
Go to Xcode preferences and then look in the ‘Downloads’ button.
Install the command line tools from the preferences of Xcode.
Getting it on in OS X Mountain Lion
This tutorial works mostly in the Terminal, launch it from /Applications/Utilities, change directory (cd) to the home account and make a directory that you will work in, call itmcrypt
cd ~ ; mkdir mcrypt ; cd mcrypt
Getlibmcrypt 2.5.8 from Sourceforge, this is direct download link.
Get thephp code in a tar.gz or .bz2 format- (version 5.3.6 - 5.3.13 are common in different builds up to OS X 10.8, 5.3.13 is current for OSX 10.8.2)
Check your version at the command line:
php -v
Move both of these files that you downloaded into your working directory – mcrypt in this instance and go back to Terminal
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.3.13.tar.gz
Remove the compressed archives
rm *.gz
Any errors on the command line including C++ and g++ mostly are due to Xcode not being installed or the command line tools missing – if you have Xcode but still get the errors, launch Xcode > Preferences > Downloads > Install ‘Command Line Tools’
Configuring libmcrypt
cd libmcrypt-2.5.8
./configure
make
sudo make install
With the libmcrypt configured and libraries now installed, time for to make the mcrypt extension.
Autoconf Errors
If the below error occurs after you try the following compile of mcrypt, then autoconf is not installed.
Cannot find autoconf. Please check your autoconf installation and the$PHP_AUTOCONF environment variable. Then, rerun this script.
Autoconf is not installed with the latest Xcode but may be present on some OS X from an upgraded older Xcode.
If you need 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.3.13/ext/mcrypt/
/usr/bin/phpize
Output should be:
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
./configure
make
sudo make install
The result of this should be:
Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20090626/
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, 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 nano /etc/php.ini
and add in the line:
extension=mcrypt.so
Restart Apache
sudo apachectl restart
That’s it, check your phpMyadmin login page or create and browse to a phpinfo.php to see if it loaded correctly, if it didn’t load you may need to declare the extensions directory in /etc/php.ini
extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20090626/"
Hopefully it wasn’t too much of a nightmare…
转自:http://www.coolestguyplanettech.com/how-to-install-mcrypt-for-php-on-mac-osx-lion-10-7-development-server/
- How to Install mcrypt for php on Mac OSX Lion 10.8 & 10.7 Development Server
- How to install YAWS on Mac OSX
- How to install Maven on Mac OSX
- How to install Maven on Mac OSX
- How to Install php-mcrypt on CentOS 6.2
- Installing PCNTL for PHP on OSX Lion
- How to setup memcache, in XAMPP mac osx lion
- How to install Windows on your Mac for free
- 在OSX狮子(Lion)上安装MYSQL(Install MySQL on Mac OSX)
- How to install Microsoft's SQL Server Driver for PHP
- How To Install Jekyll in Mac OSX Mavericks?
- How to restore deleted chrome bookmarks on Mac 10.7.3 Lion
- Install plantuml on Mac OSX
- Install liblinear on Mac OSX
- Install mpv on Mac OSX
- Install ideviceinstaller on Mac OSX
- Install ideviceinstaller on Mac OSX
- Install upx on Mac OSX
- Windows CE下USB设备驱动开发的一些基础知识
- Activity启动模式和任务栈(3)
- WinCE下自定义的大软键盘
- CSS浮动,你不知道的事(转载)
- Linux基本概念、命令总结
- How to Install mcrypt for php on Mac OSX Lion 10.8 & 10.7 Development Server
- wince下USB总线驱动分析
- nefu 674HELP(bfs)
- Problem C
- USB驱动程序的加载(二)
- java_基本数据类型的包装类
- 比较字符串大小strcmp
- USB驱动程序的加载(一)
- C++_运算符重载