ERROR: failed to mkdir /usr/include/php/ext/imagick

ERROR: failed to mkdir /usr/include/php/ext/imagick

我正在尝试在我的 Mac 上安装 Imagick,但在我使用后出现此错误:

sudo pecl install imagick
ERROR: failed to mkdir /usr/include/php/ext/imagick

这是控制台日志:

downloading imagick-3.4.3.tgz ...
Starting to download imagick-3.4.3.tgz (245,410 bytes)
...................................................done: 245,410 bytes
19 source files, building
running: phpize
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
Please provide the prefix of Imagemagick installation [autodetect] :


如果我按 return,它会不断加载很多东西,然后我会收到错误消息:

Build process completed successfully
Installing '/usr/include/php/ext/imagick/php_imagick_shared.h'
ERROR: failed to mkdir /usr/include/php/ext/imagick

这是对您问题的回答:

您可能需要更改模块的路径。 (特别阅读步骤 4 和 5)。

重启你的Mac

按住 Cmd + R

打开终端

csrutil disable
reboot

运行

sudo pecl install imagick

添加

extension=/usr/lib/php/extensions/no-debug-non-zts-XXXXXX/imagick.so

安装完成后php.ini

重启你的mac 按住 Cmd + R

打开终端

csrutil enable
reboot