Post view

在macOS Mojave 10.14安裝Homebrew再繼續安裝ImageMagick的php56-imagick模組

請先閱讀這篇前文:

在macOS Mojave 10.14安裝Homebrew與PHP 5.6

使用Homebrew安裝php56-imagick

就算你到處爬文,尋找如何修改Apache的httpd.conf,以及PHP 5.6.38的php.ini設定檔案的方式,但是「brew install php56」也只有幫你裝好PHP 5.6而已,執行PHP所需的相關模組,可說是一個也沒有裝!你還是得自己動手安裝。例如幾乎任何PHP網站系統程式都會需要用到的ImageMagick模組。

Last login: Fri Oct  5 12:51:58 on ttys001

www:~ brent$ brew install php56-imagick

Error: No available formula with the name "php56-imagick" 

==> 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...

Error: No similarly named formulae found.

==> Searching taps...

==> Searching taps on GitHub...

Error: No formulae found in taps.

www:~ brent$

你可以看到竟然沒有php56-imagick這個模組名稱!這是因為我輸入錯誤指令?絕對沒有!

Error: No available formula with the name "php56-imagick"

我到處爬文以後,發現php56-imagick已經被Homebrew移除!只能安裝新的php7-imagick、php71-imagick、php72-imagick。所以這絕對不是只有我才會遇到的問題。雖然也有人遇到相同的問題,在這裡提出問題,但很顯然沒人理會!無人回應!

brew install php56-imagick: No available formula

我找到Homebrew的部落格的文章,在今年3月的時候,就因為「不明原因」移除了PHP相關模組!

Homebrew  1.5.0 19 January 2018

  • By 31st March 2018 we will deprecate and archive the Homebrew/php tap. Unfortunately we have been unable to maintain an acceptable, consistent user or contributor experience and CI workload through non-core formula taps in the Homebrew organisation so we are continuing to migrate widely used formulae into Homebrew/core and encourage more niche formulae and options to be supported outside the Homebrew organisation.

也許對他們來說,已經把deprecate的原因、理由說明的很清楚,但是我完全看不懂!我不知道什麼是php tap,也不知道搬到Homebrew/core是什麼意思!

在16 Jan 2017就有人發現php56-imagick不能使用,但很顯然沒人想要解決問題,甚至在2018年3月的時候,乾脆直接移除Homebrew/php!

PHP56-imagick appears to be broken

繼續爬文找更多說明文章來解決什麼是Homebrew/php?什麼是Homebrew/core?為什麼不能安裝php56-imagick的問題?老實說,我不是Linux愛用者(我是厭惡終端機指令,包括Windows的MS-DOS模式),我也不是Homebrew的老手...

如果不能安裝php56-imagick,那麼直接安裝目前的最新版本php72-imagick呢?

mysql:~ brent$ brew install php72-imagick

Updating Homebrew...

Error: No available formula with the name "php72-imagick" 

==> 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...

Error: No similarly named formulae found.

==> Searching taps...

==> Searching taps on GitHub...

Error: No formulae found in taps.

在上面的提示要執行git指令。為什麼要執行git的理由完全沒有說明,只好執行看看。

mysql:~ brent$ git -C "$(brew --repo homebrew/core)" fetch --unshallow

remote: Enumerating objects: 537716, done.

remote: Counting objects: 100% (533930/533930), done.

remote: Compressing objects: 100% (191711/191711), done.

remote: Total 528845 (delta 339340), reused 523785 (delta 334283), pack-reused 

Receiving objects: 100% (528845/528845), 199.02 MiB | 2.04 MiB/s, done.

Resolving deltas: 100% (339340/339340), completed with 3929 local objects.

mysql:~ brent$ brew install php72-imagick

Error: No available formula with the name "php72-imagick" 

==> Searching for a previously deleted formula (in the last month)...

Error: No previously deleted formula found.

==> Searching for similarly named formulae...

Error: No similarly named formulae found.

==> Searching taps...

==> Searching taps on GitHub...

Error: No formulae found in taps.

mysql:~ brent$ 

當然是無法安裝!不可能解決問題!

  • brew install php55-imagick(已經無法安裝)
  • brew install php56-imagick(已經無法安裝)
  • brew install php71-imagick(已經無法安裝)
  • brew install php72-imagick(已經無法安裝)

當然,不是只有我無法安裝最新的php72-imagick,也有別人遇到相同的問題。

Homebrew: install new formula php72-imagick

但是解決辦法似乎非常繁複,改成這個方法能不能解決?我不知道,有空的時候再來研究。現在的海豚因為不支援PHP 7,所以現在就算安裝好也沒辦法使用。

In my case (PHP 7.2.10 with Homebrew) works:

pecl install imagick

Open the file php.ini and remove extension line with imagick extension.

Check *.ini files with

php --ini

You can see paths to extension files. Create or edit imagick ini file.

subl /usr/local/etc/php/7.2/conf.d/ext-imagick.ini

The content of file may be (check the path to imagick.so)

[imagick]

extension="/usr/local/opt/php/pecl/20170718/imagick.so"

And restart php with

brew services restart php

Try, if the error message dissapear:

php -v

And check imagick extension with:

php -i | grep imagick

If you see line with imagick module => enabled you have solved a problem.

多年來,我一直是安裝完Homebrew與想要使用的模組以後,就移除Homebrew,不想使用,更不想知道,完全不想深入了解!因為我完全不想在Mac電腦,特別是insoler網站的伺服器主機上,放一個可以讓駭客入侵,還可以繼續下載、安裝更多無人嚴格檢查,無人嚴密把關的「地下套件」!

insoler、BNW網站,幾乎沒有任何駭客可以成功入侵網站、入侵伺服器主機(雖然幾乎天天都有駭客想要入侵),當然是因為多年來,我做了非常多的安全措施與加強安全防護的各種努力!

既然Homebrew在部落格上沒有說明搬到Homebrew/core要改用什麼指令,也沒有任何的「範例」說明。我也懶的研究這種無聊的事情,所以就直接放棄!

不過,在放棄以前,我還是改用另外一個更老牌的MacPorts來測試看看,不過我對「命令列環境」沒有任何好感!因為毫無安全性可言,還要死背一堆毫無意義的指令、設定檔。如果你有興趣,請繼續閱讀這篇文章:

在macOS Mojave 10.14安裝MacProts再繼續加裝php55-imagick、php72-imagick、php55-ssh2模組

蘇言霖 2018/10/24 0 2875
Comments
Order by: 
Per page:
 
  • There are no comments yet
Rate
0 votes
Post info
蘇言霖
「超級懶貓級」社群網站站長
2018/10/24 (2014 days ago)
Actions