laravel 在 Mac OS X Yosemite 10.10 上使用 Mamp Pro 的 Mcrypt

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26449275/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 10:18:12  来源:igfitidea点击:

Mcrypt with Mamp Pro on Mac OS X Yosemite 10.10

phpmacoslaravelmamposx-yosemite

提问by lasagne

After the Yosemite update yesterday, something is messed up with the Mcrypt extension. The PHP based artistan CLI of the Laravel frameworkreturns:

在昨天优胜美地更新之后,Mcrypt 扩展出现了一些问题。Laravel 框架的基于 PHP 的美工 CLI返回:

Mcrypt PHP extension required.

需要 Mcrypt PHP 扩展。

The PATH variable seems to be correct. Where is the misconfig? Before the update everything worked fine.

PATH 变量似乎是正确的。错误配置在哪里?更新前一切正常。

++++ Configs ++++

++++ 配置 ++++

Output of 'which php':

'which php'的输出:

/Applications/MAMP/bin/php/php5.6.1/bin/php

/Applications/MAMP/bin/php/php5.6.1/bin/php

'php -v':

'php -v':

PHP 5.6.1 (cli) (built: Oct 13 2014 18:41:35) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies

PHP 5.6.1 (cli)(构建时间:2014 年 10 月 13 日 18:41:35) 版权所有 (c) 1997-2014 The PHP Group Zend Engine v2.6.0,版权所有 (c) 1998-2014 Zend Technologies

Content of .bash_profile:

.bash_profile 的内容:

export EDITOR=nano export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin:/usr/local/mysql/bin export PATH=/Applications/MAMP/bin/php/php5.6.1/bin:$PATH

导出编辑器=纳米导出路径=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin:/usr/local/mysql/bin导出路径=/Applications/MAMP/bin/php/php5.6.1/bin:$PATH

phpinfo(): enter image description hereMcrypt part

phpinfo(): 在此处输入图片说明Mcrypt 部分

MAMP PRO Version:

MAMP专业版:

3.0.7.1

3.0.7.1

UPDATE:

更新:

Mamp-log says for every extension enabled in php.ini:

Mamp-log 对 php.ini 中启用的每个扩展说:

PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php/php5.6.1/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' - dlopen(/Applications/MAMP/bin/php/php5.6.1/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so, 9): image not found in Unknown on line 0

PHP 警告:PHP 启动:无法加载动态库 '/Applications/MAMP/bin/php/php5.6.1/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' - dlopen(/Applications /MAMP/bin/php/php5.6.1/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so, 9): 在第 0 行的 Unknown 中找不到图像

采纳答案by Nicolas Widart

I've contacted MAMP support, and this is what they responded.

我已经联系了 MAMP 支持,这就是他们的回应。

Hi,

Our php.ini file is messed up for 5.6.1. Go to your template files and change this line

/Applications/MAMP/bin/php/php5.6.1 ....

to

/Applications/MAMP/bin/php/php5.6.1/lib/php/extensions/no-debug-non-zts-20131226

We will have a full fix in a few days. You can also just downgrade to php 5.5. in the meantime.

你好,

我们的 php.ini 文件被 5.6.1 弄乱了。转到您的模板文件并更改此行

/Applications/MAMP/bin/php/php5.6.1 ....

/Applications/MAMP/bin/php/php5.6.1/lib/php/extensions/no-debug-non-zts-20131226

我们将在几天内进行全面修复。您也可以降级到 php 5.5。同时。

回答by Maaaark

I just had the same problem.

我只是遇到了同样的问题。

Just use PHP Version 5.5.17 in MAMP and everything should work fine again.

只需在 MAMP 中使用 PHP 5.5.17 版,一切都应该可以正常工作了。

Remember to switch the version in your .bash_profile too:

请记住也要切换 .bash_profile 中的版本:

export PATH=/Applications/MAMP/bin/php/php5.5.17/bin:$PATH

回答by C13L0

The hotfix was applied this morning MAMP & MAMP PRO 3.0.7.2 Published: 2014-10-21. Default php 5.6.2

今天早上应用了修补程序 MAMP & MAMP PRO 3.0.7.2 发布时间:2014-10-21。默认 php 5.6.2

Don't forget to update .bash_profile

不要忘记更新 .bash_profile

export PATH=/Applications/MAMP/bin/php/php5.6.2/bin:$PATH

导出路径=/Applications/MAMP/bin/php/php5.6.2/bin:$PATH

Everything works fine on my local and it also works fine with drush (for those that use it)

在我的本地一切正常,它也适用于 drush(对于那些使用它的人)

回答by liasica

the same error with you, but I perfect sloved it now:

你也犯了同样的错误,但我现在完美地解决了它:

  • Stop your MAMP
  • Open /Applications/MAMP/bin/php/php5.6.1/conf/php.ini
  • Find all "no-debug-non-zts-20121212" replace by "no-debug-non-zts-20131226"
  • Open /Applications/MAMP/bin/php/php5.6.1/conf/pear.conf
  • Find "no-debug-non-zts-20100525" replace by "no-debug-non-zts-20131226"
  • Start your server
  • 停止你的 MAMP
  • 打开/Applications/MAMP/bin/php/php5.6.1/conf/php.ini
  • 查找所有“no-debug-non-zts-20121212”替换为“no-debug-non-zts-20131226”
  • 打开/Applications/MAMP/bin/php/php5.6.1/conf/pear.conf
  • 找到“no-debug-non-zts-20100525”替换为“no-debug-non-zts-20131226”
  • 启动你的服务器

I recommend you unistall OS X's default php and apache Path:

我建议您卸载 OS X 的默认 php 和 apache 路径:

/etc/apache2
/usr/include/apahce2
/usr/libexec/apache2
/usr/php
/usr/bin/php
/usr/bin/php-config
/usr/bin/phpize
/usr/include/php
/usr/lib/php
/usr/share/man/man*/php*
/usr/bin/phar.phar

then

然后

sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/pear /usr/bin/pear
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/peardev /usr/bin/peardev
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/pecl /usr/bin/pecl
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/phar.phar /usr/bin/phar.phar
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/php /usr/bin/php
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/php-cgi /usr/bin/php-cgi
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/php-config /usr/bin/php-config
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/phpize /usr/bin/phpize

回答by LukeSz

1) First check what php.ini file is loaded:

1)首先查看加载了什么php.ini文件:

php --ini

php --ini

You will probably see that none of the files have been loaded.

您可能会看到没有加载任何文件。

2) If you don't mind reinstalling php you can do this:

2)如果您不介意重新安装php,您可以这样做:

curl -s http://php-osx.liip.ch/install.sh| bash -s 5.6

curl -s http://php-osx.liip.ch/install.sh| bash -s 5.6

3) Then set the path to your new php installation in order to avoid using the native php that comes with OSX.

3)然后设置新的php安装路径,以避免使用OSX自带的原生php。

In order to set the path use this command - something like this, bear in mind that your path could be different:

为了设置路径,请使用此命令 - 像这样,请记住您的路径可能不同:

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

导出路径=/usr/local/php5/bin:$PATH