首页 > 解决方案 > 错误:无法 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] :


如果我按回车键,它会继续加载很多东西,然后我得到错误:

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

标签: phpimagick

解决方案


重新启动你的 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

推荐阅读