Laravel 需要 Mcrypt PHP 扩展 [英] Laravel requires the Mcrypt PHP extension

查看:41
本文介绍了Laravel 需要 Mcrypt PHP 扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 OSX 上的 Laravel 4 中使用 migrate 函数.但是,我收到以下错误:

Laravel 需要 Mcrypt PHP 扩展.

据我所知,它已经启用(见下图).

出了什么问题,我该如何解决?

解决方案

启用 Web 的扩展和启用命令行的扩展可能不同.在终端中运行 php -m 并检查是否列出了 mcrypt.如果不是,则通过从终端运行 php --ini 来检查命令行从何处加载 php.ini 文件.

在这个 php.ini 文件中,您可以启用扩展.

OSX

我听说有人在 OSX 上遇到问题,因为终端指向 OSX 附带的本机 PHP.您应该改为更新您的 bash 配置文件以包含您的 PHP 的实际路径.像这样的东西(我实际上不使用 OSX,所以这可能不是 100%):

export PATH=/usr/local/php5/bin:$PATH

Ubuntu

在较早版本的 Ubuntu(14.04 之前)上,当您运行 sudo apt-get install php5-mcrypt 时,它实际上并未将扩展安装到 mods-available 中>.您需要对其进行符号链接.

sudo ln -s/etc/php5/conf.d/mcrypt.ini/etc/php5/mods-available/mcrypt.ini

在所有 Ubuntu 版本上,您都需要在安装后启用该 mod.你可以用 php5enmod 做到这一点.

sudo php5enmod mcrypt须藤服务 apache2 重启

<块引用>

注意事项

I am trying to use the migrate function in Laravel 4 on OSX. However, I am getting the following error:

Laravel requires the Mcrypt PHP extension.

As far as I understand, it's already enabled (see the image below).

What is wrong, and how can I fix it?

解决方案

The web enabled extensions and command line enabled extensions can differ. Run php -m in your terminal and check to see if mcrypt is listed. If it's not then check where the command line is loading your php.ini file from by running php --ini from your terminal.

In this php.ini file you can enable the extension.

OSX

I have heard of people on OSX running in to problems due to the terminal pointing to the native PHP shipped with OSX. You should instead update your bash profile to include the actual path to your PHP. Something like this (I don't actually use OSX so this might not be 100%):

export PATH=/usr/local/php5/bin:$PATH

Ubuntu

On earlier versions of Ubuntu (prior to 14.04) when you run sudo apt-get install php5-mcrypt it doesn't actually install the extension into the mods-available. You'll need to symlink it.

sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/mcrypt.ini

On all Ubuntu versions you'll need to enable the mod once it's installed. You can do that with php5enmod.

sudo php5enmod mcrypt
sudo service apache2 restart

NOTES

这篇关于Laravel 需要 Mcrypt PHP 扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆