在 ubuntu 14.04 上安装 Laravel 时出现 ext-mcrypt 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28406605/
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
ext-mcrypt error while installing laravel on ubuntu 14.04
提问by Hardik Ranpariya
I am beginner in laravel in ubuntu 14.04. I try to run this following commend for install laravel.
我是 ubuntu 14.04 中 Laravel 的初学者。我尝试运行以下命令来安装 laravel。
composer create-project laravel/laravel --prefer-dist
and i got following error. i am also try to install ncrypt but i got same error.
我得到了以下错误。我也尝试安装 ncrypt 但我遇到了同样的错误。
Installing laravel/laravel (v5.0.1)
- Installing laravel/laravel (v5.0.1)
Loading from cache
Created project in /opt/lampp/htdocs/laravel
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework v5.0.2 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
- laravel/framework v5.0.1 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
- laravel/framework v5.0.0 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
- Installation request for laravel/framework 5.0.* -> satisfiable by laravel/framework[v5.0.0, v5.0.1, v5.0.2].
i am also try to run this command but i got this same error.
我也尝试运行此命令,但我遇到了同样的错误。
sudo apt-get install mcrypt php5-mcrypt
sudo php5enmod mcrypt
sudo service apache2 restart
Thanks in advance..
提前致谢..
回答by Hardik Ranpariya
I am open this file
我打开这个文件
gedit /etc/php5/cli/php.ini
put one line in to this file
在这个文件中加入一行
extension=mcrypt.so
and this run successfully.
这运行成功。
any ways thanks again.
任何方式再次感谢。
回答by shin
This is how I solved on Mac Yosemite. I have one php.ini in /etc/, and I have mcrypt instaIled. But I faced the same problem.
这就是我在 Mac Yosemite 上解决的方法。我在 /etc/ 中有一个 php.ini,并且我已经安装了 mcrypt。但我遇到了同样的问题。
Run this to find another php.ini.
运行它以找到另一个 php.ini。
php -i|grep ini
It returned the followings.
它返回了以下内容。
System => Darwin Myname-MacBook-Pro.local 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Configuration File (php.ini) Path => /usr/local/etc/php/5.5
Loaded Configuration File => /usr/local/etc/php/5.5/php.ini
....
I open /usr/local/etc/php/5.5/php.ini and added extension=mcrypt.so
to the file.
我打开 /usr/local/etc/php/5.5/php.ini 并添加extension=mcrypt.so
到文件中。
I hope this will help someone in future.
我希望这会在将来对某人有所帮助。
回答by Lewis
Mac users with brew just run in CLI:
使用 brew 的 Mac 用户只需在 CLI 中运行:
brew install php56-mcrypt
Doinion Rings.
Doinion 戒指。