laravel 如何在 mac os x yosemite (10.10) 上安装 mcrypt 扩展
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24143152/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install mcrypt extension on mac os x yosemite (10.10)
提问by Anubz
I've updated my Mac OS X to Yosemite, but doing that I over write all my dev environment. So now, to run Laravel 4 on my local apache I need to install the Mcrypt extension, but everything that i've tried i fail. Even the steps that have worked on OS X Mavericks (10.9)
我已将我的 Mac OS X 更新为 Yosemite,但这样做我覆盖了我所有的开发环境。所以现在,要在我的本地 apache 上运行 Laravel 4,我需要安装 Mcrypt 扩展,但是我尝试过的一切都失败了。即使是在 OS X Mavericks (10.9) 上运行的步骤
Anybody has the same issue? Thanks in advance.
有人有同样的问题吗?提前致谢。
Cheers
干杯
采纳答案by davidcondrey
I just installed it right now on my Mavericks installation using homebrew and it worked surprisingly well. Can't say whether or not it will work so well on Yosemite but worth a shot..
我现在刚刚使用自制软件将它安装在我的 Mavericks 安装上,并且效果出奇地好。不能说它在优胜美地是否会如此有效,但值得一试..
Homebrew
家酿
brew install autoconf
brew install mcrypt
Macports
麦克波特
Check PHP version
php -v
Update Macports
sudo port -v selfupdate
Download & install the appropriate version..
sudo port install php55-mcrypt
now dummy proof it..
Find where Macports put the file mcrypt.so and copy it to all instances of
/php/extensions/no-debug-...
folder. If you have that directory structure in multiple places, copy it to all of them. So every php/extensions/no-debug.. folder on your computer has a copy ofmcrypt.so
sudo cp /opt/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20090626/
Determine where your php.ini file is and make sure it's the one your actually using because you may have this file in more than 1 place. Do this to all
php.ini
files you find..Within that file find and uncomment the following line. If it's commented out, uncomment it. If it's not in the file at all, add it. In my default php.ini file I found this on line 536:
extension=mcrypt.so
检查 PHP 版本
php -v
更新 Macports
sudo port -v selfupdate
下载并安装合适的版本..
sudo port install php55-mcrypt
现在虚拟证明它..
找到 Macports 放置文件 mcrypt.so 的位置并将其复制到
/php/extensions/no-debug-...
文件夹的所有实例。如果您在多个位置都有该目录结构,请将其复制到所有位置。因此,您计算机上的每个 php/extensions/no-debug.. 文件夹都有一个mcrypt.so
sudo cp /opt/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20090626/
确定您的 php.ini 文件在哪里,并确保它是您实际使用的文件,因为您可能在 1 个以上的地方拥有该文件。对
php.ini
您找到的所有文件执行此操作。在该文件中找到并取消注释以下行。如果已注释掉,请取消注释。如果它根本不在文件中,请添加它。在我的默认 php.ini 文件中,我在第 536 行找到了这个:
extension=mcrypt.so
Compile
编译
Download mcrypt
curl -O http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
Uncompress it
tar -zxvf libmcrypt-2.5.8.tar.gz
Configure, build, and install
./configure && make && sudo make install
Download Autoconf
curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
Uncompress it
tar xvfz autoconf-latest.tar.gz
Configure, build, and install
./configure && make && sudo make install
下载 mcrypt
curl -O http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
解压
tar -zxvf libmcrypt-2.5.8.tar.gz
配置、构建和安装
./configure && make && sudo make install
下载自动配置
curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
解压
tar xvfz autoconf-latest.tar.gz
配置、构建和安装
./configure && make && sudo make install
Apache
阿帕奇
Regardless which method you used to install it. You should always restart Apache when your done.
无论您使用哪种方法安装它。完成后,您应该始终重新启动 Apache。
Restart Apache
sudo apachectl restart
重启阿帕奇
sudo apachectl restart
回答by Arda
I just did these and it installed. MAMP etc. is not installed.
我只是做了这些并安装了它。未安装 MAMP 等。
brew tap josegonzalez/homebrew-php
brew install php55-mcrypt
And weirdly, I had to reinstall to make it install properly.
奇怪的是,我必须重新安装才能正确安装。
brew reinstall php55-mcrypt
However, this also re-installed PHP5.5 from source, but no matter, all is working fine on my end.
但是,这也从源代码重新安装了 PHP5.5,但无论如何,我的一切都运行良好。
回答by Stephen Fraser
First Install libtool from homebrew, which is a dependency in 10.10 Yosemite
首先从 homebrew 安装 libtool,它是 10.10 Yosemite 的依赖项
brew reinstall libtool --universal && brew unlink libtool && brew link libtool
Then CD to your php directory
然后CD到你的php目录
cd /usr/local/php5
And into your php.d directory
并进入您的 php.d 目录
cd php.d
Then finally do a quick ls to see which extensions you are using:
然后最后做一个快速 ls 以查看您正在使用哪些扩展:
ls -l
If you see duplicate entries containing "mcrypt" you will need to open one of them up, and comment out the line:
如果您看到包含“mcrypt”的重复条目,您需要打开其中之一,并注释掉该行:
extension=mcrypt.so
to
到
;;extension=mcrypt.so
But only in one of them. For me it was mcrypt.ini. So..
但仅限于其中之一。对我来说是 mcrypt.ini。所以..
sudo nano mcrypt.ini
added the line and done!
添加行并完成!
回答by TheTC
I had the same problem. But, I'm using MAMP for my local development. So, I just needed to symlink the php file over to MAMP's version and all is working.
我有同样的问题。但是,我正在使用 MAMP 进行本地开发。所以,我只需要将 php 文件符号链接到 MAMP 的版本,一切正常。
If using homebrew, try reinstalling or relinking your php install.
如果使用自制软件,请尝试重新安装或重新链接您的 php 安装。
I'm sure I can help you get back up and working, so just let me know if that doesn't help.
我相信我可以帮助你恢复工作,所以如果这没有帮助,请告诉我。