Mac Mojava 通過 homebrew 安裝 PHP5.6 版本正確姿勢

WizardPro發表於2019-06-28

本文轉自: https://blog.csdn.net/w605283073/article/d...

由於歷史專案用到了php5.6.31版本,而homebrew官方又在2018-01-19的時候宣佈移除Homebrew/php庫,導致不能通過homebrew安裝PHP歷史版本,通過google找到了這篇正確姿勢的文章,分享給大家。

在Mac電腦上Mojava版本想通過homebrew安裝php56發現安裝失敗。

$ brew info php@5.6.31
Error: No available formula with the name "php@5.6.31"
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
$ brew search php
==> Formulae
brew-php-switcher                                         php@7.2
denji/nginx/php-session-nginx-module                      phplint
homebrew/nginx/php-session-nginx-module                   phpmd
php ✔                                                     phpmyadmin
php-code-sniffer                                          phpstan
php-cs-fixer                                              phpunit
php@7.1

==> Casks
eclipse-php                            netbeans-php                           phpstorm

在stackoverflow上找到一個好的方案:

  1. 安裝exolnet/homebrew-deprecated

    brew tap exolnet/homebrew-deprecated
    $ brew tap exolnet/homebrew-deprecated
    Updating Homebrew...
    ==> Auto-updated Homebrew!
    Updated 1 tap (homebrew/cask).
    No changes to formulae.
    ==> Tapping exolnet/deprecated
    Cloning into '/usr/local/Homebrew/Library/Taps/exolnet/homebrew-deprecated'...
    remote: Enumerating objects: 11, done.
    remote: Counting objects: 100% (11/11), done.
    remote: Compressing objects: 100% (11/11), done.
    remote: Total 11 (delta 1), reused 7 (delta 0), pack-reused 0
    Unpacking objects: 100% (11/11), done.
    Tapped 2 formulae (42 files, 78.2KB).
  2. 安裝php5.6

    $ brew install php@5.6 -vvv
    ==> Installing php@5.6 from exolnet/deprecated
    ==> Downloading https://dl.bintray.com/exolnet/bottles-deprecated/php@5.6-5.6.40.mojave.bottle.2.tar.gz
    ==> Downloading from 
    ...
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
    100 17.6M  100 17.6M    0     0   167k      0  0:01:48  0:01:48 --:--:--  126k
    ==> Verifying 01fecf5967040be0a73a38437b1e98b9b291b9e9ab2060eb248861e1553f26f4--php@5.6-5.6.40.mojave.bottle.2.tar.gz checksum
    ==> Pouring php@5.6-5.6.40.mojave.bottle.2.tar.gz
    ...
    ==> Summary
    ?  /usr/local/Cellar/php@5.6/5.6.40: 498 files, 60.5MB

    至此安裝完成

本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章