【问题标题】:Install PHP Extension for PHP 5.6 on OSX with deprecated homebrew/php在 OSX 上使用已弃用的 homebrew/php 安装 PHP 5.6 的 PHP 扩展
【发布时间】:2018-09-13 22:30:42
【问题描述】:

今天我更新了 Brew,现在我无法安装 php56-extensions。

在我的 Mac 上安装了“php56”,今天我需要安装“php56-redis”,但是当我尝试安装此扩展时,Brew 返回以下错误消息。

$ brew install php56-redis

Error: No available formula with the name "php56-redis" 
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

我在 homebrew/php 页面上看到这个“tap”已被弃用,现在只有 PHP 引擎在 php@5.6 上迁移,但扩展不起作用。

【问题讨论】:

  • 您应该添加您的解决方法作为答案。
  • 感谢您的信息。

标签: php macos homebrew deprecated php-extension


【解决方案1】:

现在是 2022 年,我只发现 https://github.com/shivammathur/homebrew-php 仍在工作。

Error while doing `brew tap exolnet/homebrew-deprecated`

编辑:

事实证明,您可能还需要旧版 mysql 5.7 和古老的 php,我最终使用 lando(基于 docker)来运行它。这是我的 .lando.yml:

name: app
recipe: drupal6 # pulls also composer and drush as a colateral, any other php 5.6 application will work never the less
config:
  php: '5.6'
  database: mysql:5.7
  webroot: .

向我的考古学家们问好;)

【讨论】:

    【解决方案2】:

    首先安装 exolnet/homebrew-deprecated

    $ brew tap exolnet/homebrew-deprecated
    

    安装弃用包后

    $ brew install php@5.6
    

    【讨论】:

    • @RyanCoolwebs 确实如此。
    • 很好的答案...希望我很久以前就找到了。谢谢!
    • 是的!谢谢。
    • 现在不行了
    【解决方案3】:

    我找到了在我的 Mac 上使用旧版本 homebrew/php 的解决方案。

    第 1 步

    转到 php56 的 homebrew/php 的最后一个有效版本

    https://github.com/Homebrew/homebrew-php/tree/966f6c318be2d80b4953cd8cdc112b9611eff8d9

    并下载 Zip 文件。

    自制-php-966f6c318be2d80b4953cd8cdc112b9611eff8d9.zip

    第 2 步

    前往

    /usr/local/Homebrew/Library/Taps/homebrew/
    

    并重命名 Tap

    自制-php

    老自制-php

    第 3 步

    解压

    自制-php-966f6c318be2d80b4953cd8cdc112b9611eff8d9.zip

    /usr/local/Homebrew/Library/Taps/homebrew/ 
    

    并在

    中重命名文件夹

    自制-php

    第 4 步

    用 brew 搜索你的 php 扩展:

    $ brew search php56-redis
    ==> Searching local taps...
    homebrew/php/php56-redis
    ==> Searching taps on GitHub...
    ==> Searching blacklisted, migrated and deleted formulae...
    

    第 5 步

    安装不更新的软件包:

    HOMEBREW_NO_AUTO_UPDATE=1 brew install homebrew/php/<formula>
    

    这将停止此命令的自制程序更新。如果您想阻止 shell 会话的自动更新,请使用:

    export HOMEBREW_NO_AUTO_UPDATE=1
    

    要永久设置,请将其添加到您的 ~/.bash_profile。

    【讨论】:

    • 在第 2 步中,您最好运行 brew untap homebrew/php 以将其从系统中完全删除。它已被归档(不再更新),并且所有版本的 PHP 和 PHP 扩展都已从中删除。现在没用了。
    猜你喜欢
    • 2018-09-12
    • 1970-01-01
    • 2019-01-13
    • 2020-12-27
    • 2021-12-23
    • 1970-01-01
    • 2012-12-30
    • 2017-07-21
    相关资源
    最近更新 更多