mac通过brew安装php,以及php模块,一致出现一个 "Unable to initialize module"。也一直不知道什么原因,一直放着。今天,看laravel的图像依赖包“intervention”,想使用 "imagick" 图像库,发现就是这个问题导致加载不了imagick,只有google了。发现下面这个地址,以前没注意:
https://github.com/Homebrew/homebrew-php/issues/1743
解释了:
If you compile PHP with debug, you'll have to install extensions from source as well.
一旦我们安装php时,使用了 "--debug",就应该从源代码来安装扩展,而不是从"bintray binary" 来安装。
brew 默认是从 "bintray binary" 来安装的,我们在安装时,可传入 "-fs" 参数,来从源代码来安装
brew remove php71-imagick
brew install php71-imagick -fs
总结:
有时间,可以看看上面的地址,应该就是brew来支持php安装的官方文档