【问题标题】:How to set MCRYPT path back to MAMP Pro如何将 MCRYPT 路径设置回 MAMP Pro
【发布时间】:2019-11-16 15:04:11
【问题描述】:

我已经使用 PHP 7.2 在 MAMP Pro 上安装了 MCRPYT,并且能够运行我的旧项目 Laravel 4.2。

这是我的 MAMP PHP.ini 中的列表

extension=mcrypt.so

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
extension_dir = "/Applications/MAMP/bin/php/php7.2.1/lib/php/extensions/no-debug-non-zts-20170718/"

但是当我运行 which mcrypt 时,它默认为 /usr/local/bin/mcrypt,我认为它应该在 MAMP Pro 下。

我之所以问这个是因为,我想将我的项目 Laravel 4.2 升级到 5.0。 这是我尝试安装新的 Laravel 5.0 时的问题

composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework v5.0.9 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.8 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.7 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.6 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - 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.35 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.34 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.33 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.32 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.31 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.29 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.28 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.27 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.26 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.25 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.24 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.23 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.22 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.21 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.20 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.19 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.18 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.17 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.16 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.15 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.14 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.13 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.12 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.11 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - laravel/framework v5.0.10 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.
    - laravel/framework 5.0.30 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - Installation request for laravel/framework 5.0.* -> satisfiable by laravel/framework[5.0.30, v5.0.0, v5.0.1, v5.0.10, v5.0.11, v5.0.12, v5.0.13, v5.0.14, v5.0.15, v5.0.16, v5.0.17, v5.0.18, v5.0.19, v5.0.2, v5.0.20, v5.0.21, v5.0.22, v5.0.23, v5.0.24, v5.0.25, v5.0.26, v5.0.27, v5.0.28, v5.0.29, v5.0.3, v5.0.31, v5.0.32, v5.0.33, v5.0.34, v5.0.35, v5.0.4, v5.0.5, v5.0.6, v5.0.7, v5.0.8, v5.0.9].

  To enable extensions, verify that they are enabled in your .ini files:
    - /Applications/MAMP/bin/php/php7.2.1/conf/php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

注意

如果你想知道我是如何使用带有 MCrypt 的 PHP 7.2 运行 Laravel 4.2 的。检查此链接。

https://medium.com/@tomgrohl/making-laravel-4-2-work-with-php-7-2-e9149a9428c3

【问题讨论】:

  • 很确定 mcrypt 自 PHP 7.2 以来已被删除......你真的想使用 Laravel 5.0 吗?也许您可以安装 Laravel 6 的新副本并将内容移到它上面
  • 我现在正在运行实验,因为我拥有的项目目前正在使用 laravel 4.2 并检查是否将其升级到 5.0 对我来说很容易,尽管这并不像预期的那样。我遵循本指南medium.com/@tomgrohl/…,该项目在 laravel 4.2 上运行良好。

标签: php laravel


【解决方案1】:

如果php版本低于7.1:

安装并启用 mcrypt:

sudo apt-get install mcrypt php-mcrypt
sudo phpenmod mcrypt

尝试找到您的 php.ini 并打开它。

vim php.ini

在这个文件中加入一行

extension=mcrypt.so

重启php和apache。

其他

尝试将您的 laravel 版本升级到 5.5 以上。 喜欢:

     "laravel/framework": "5.5.*"

由于您安装的框架是 5.0,它需要PHP >= 5.4, PHP < 7。 见:https://laravel.com/docs/5.0#server-requirements

【讨论】:

  • 我认为不会有 PHP >= 7.2.0 的 mcrypt 包
  • @lagbox 你是对的。在搜索 php.net 参考后,它说许多(所有)mcrypt 函数自 PHP 7.1.0 起已被弃用。
  • 我都在我的 osx 上运行 mcrypt。一个用osx,另一个用mamp pro。问题是,我忘记了如何将 mcrypt 指向 mamp pro,第二,我放错了有它的指南的网站。如果有的话,请在我的问题中查看我的注释以供参考。
  • @iMarkDesigns 那么,升级你的胸肌吗?
  • @TsaiKoga 是的。它已升级。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-05-12
  • 2016-07-09
  • 1970-01-01
  • 2017-11-23
  • 2014-12-14
  • 2010-11-26
  • 2011-10-27
相关资源
最近更新 更多