laravel 您的系统中缺少 MCrypt。优胜美地操作系统
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28546217/
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
MCrypt is missing from your system. OS Yosemite
提问by JoshJohnsonUK
So at work, I've been tasked to learn and start to use some Laravel, so I've been following the documentation and some tutorials on Youtube, but I cannot seem to get it working. I am using composer and MAMP to install Laravel. When I use the command (in the terminal) "composer create-project laravel/laravel TestLaravel" while in htdocs. It quickly comes up with this error:
所以在工作中,我的任务是学习并开始使用一些 Laravel,所以我一直在关注 Youtube 上的文档和一些教程,但我似乎无法让它工作。我正在使用 composer 和 MAMP 来安装 Laravel。当我在 htdocs 中使用命令(在终端中)“composer create-project laravel/laravel TestLaravel”时。它很快就出现了这个错误:
? htdocs composer create-project laravel/laravel TestLaravel
Installing laravel/laravel (v5.0.1)
- Installing laravel/laravel (v5.0.1)
Loading from cache
Created project in TestLaravel
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.5 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
- laravel/framework v5.0.4 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
- laravel/framework v5.0.3 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
- 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, v5.0.3, v5.0.4, v5.0.5].
I was wondering if anyone would have a solution to this problem for me.
我想知道是否有人能为我解决这个问题。
Thank you.
谢谢你。
Joshua Johnson
约书亚约翰逊
回答by cyber8200
Mac OS X Yosemite
Mac OS X 优胜美地
the requested PHP extension mcrypt is missing from your system
您的系统中缺少请求的 PHP 扩展 mcrypt
I fixed this error by running the following commands in my Terminal :
我通过在终端中运行以下命令来修复此错误:
brew update
brew upgrade
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php54-mcrypt
回答by Mandeep Gill
Mostly this problem comes when your MAMP PHP Version not match with command version php. Please have a look in terminal by type php -v then it will show version like php 5.5.*
大多数情况下,当您的 MAMP PHP 版本与命令版本 php 不匹配时,就会出现此问题。请通过键入 php -v 在终端中查看,然后它会显示类似 php 5.5.* 的版本
The problem is you have to set your MAMP PHP Path in ~/.bash_profile
like this :
问题是你必须~/.bash_profile
像这样设置你的 MAMP PHP 路径:
sudo nano ~/.bash_profile
PATH="/Applications/MAMP/bin/php/php5.6.7/bin:$PATH"
That's all, or install mcrypt lib if you want to use your default system php.
就是这样,如果您想使用默认系统 php,请安装 mcrypt lib。
回答by Jesse Schutt
The way that I got around this was to install Homesteadand make sure to log in to the Homestead Virtual Machine before running any commands. MCrypt is not installed on your local machine, but it is in Homestead.
我解决这个问题的方法是安装Homestead并确保在运行任何命令之前登录到 Homestead 虚拟机。MCrypt 没有安装在你的本地机器上,但它在 Homestead 中。
回答by Alan Storm
There's a PHP extension named mcrypt
that's often not distributed with stock PHP packages. The mcrypt
extension is the defacto standard PHP extension for encryption and hashing functionality. Laravel uses mcrypt.
有一个名为 PHP 的扩展mcrypt
,它通常不随库存 PHP 包分发。该mcrypt
扩展是用于加密和散列功能的事实上的标准 PHP 扩展。Laravel 使用 mcrypt。
The built in PHP on OS X does not come with mcrypt
installed. This means you either need to
OS X 上的内置 PHP 没有mcrypt
安装。这意味着你要么需要
- Build and install the
mcrypt
extension yourself for OS X's built in PHP - Use homebrew to build and install PHP with mycrypt
- Use a "pre-compiled for OS X" PHP package.
- Use a vagrant virtual machine to run your development stack
mcrypt
自己为 OS X 内置的 PHP构建和安装扩展- 使用自制软件通过 mycrypt 构建和安装 PHP
- 使用“为 OS X 预编译”的 PHP 包。
- 使用 vagrant 虚拟机运行您的开发堆栈
I usually chose the third option, and use the lipp.chpackage. This is a long running project, and has it's roots in the old entropy.ch packages managed by Marc Liyanage from even further back.
我通常选择第三个选项,并使用lipp.ch包。这是一个长期运行的项目,它起源于由 Marc Liyanage 管理的旧 entropy.ch 包。