简体   繁体   English

在OSX El Capitan上安装imagick for PHP:随附的pcre.h文件存在问题

[英]Installing imagick for PHP on OSX El Capitan: issue with included pcre.h file

I am trying to install the imagick wrapper for PHP. 我正在尝试为PHP安装imagick包装器。 I am using OSX, bundled version of PHP and have installed Image Magick using MacPorts. 我正在使用OSX(PHP的捆绑版),并已使用MacPorts安装了Image Magick。 When I attempt to install Imagick wrapper I get through the phpize and ./configure steps but the compilation fails. 当我尝试安装Imagick包装程序时,我完成了phpize和./configure步骤,但是编译失败。

In the terminal, after I run the 'make' command, everything proceeds happily until I receive this fatal error: 在终端中,运行“ make”命令后,一切都会愉快进行,直到收到致命错误:

In file included from /usr/local/imagick-3.4.1/imagick.c:37:
In file included from /usr/include/php/ext/spl/spl_iterators.h:27:
/usr/include/php/ext/pcre/php_pcre.h:29:10: fatal error: 'pcre.h' file not found
#include "pcre.h"**

I have attempted to create a symlink to the pcre.h file that was installed using MacPorts but El Cap doesn't throws "Operation not permitted" errors when I try and I know that this is related to the new limited super user privs in El Cap. 我尝试创建到使用MacPorts安装的pcre.h文件的符号链接,但是当我尝试运行El Cap时不会抛出“不允许操作”错误,而且我知道这与El中新的受限超级用户privs有关帽。

# tried both:
sudo ln -s /opt/local/include/pcre.h /usr/include/php/ext/pcre
sudo ln -s /opt/local/include/pcre.h /usr/include/

Can anyone suggest a way that I can get "/usr/include/php/ext/pcre/php_pcre.h" to find the file "/opt/local/include/pcre.h"? 谁能建议我获取“ /usr/include/php/ext/pcre/php_pcre.h”以找到文件“ /opt/local/include/pcre.h”的方法?

I know that I can install PHP via MacPorts and that this might end up being the "simplest" solution but I would prefer to continue using the bundled version of PHP before installing PHP via MacPorts. 我知道我可以通过MacPorts安装PHP,而这最终可能是“最简单”的解决方案,但是我希望在通过MacPorts安装PHP之前继续使用捆绑版本的PHP。

Thanks in advance and my apologies since I just found a similar question here . 预先感谢您的歉意,因为我在这里找到了类似的问题。 I think my question is slightly different and I am too much of a noob on stack exchange to make comments and ask questions (and I certainly am in no position to post an answer :) ) 我认为我的问题略有不同,在堆栈交换上我实在是一个菜鸟,无法发表评论和提出问题(而且我当然无权发表答案:))

Here by the way is my sequence of shell commands: 顺便说一下,这是我的shell命令序列:

cd /usr/local/
sudo curl -O https://pecl.php.net/get/imagick-3.4.1.tgz
sudo tar zxf imagick-3.4.1.tgz
cd imagick-3.4.1
sudo phpize
sudo ./configure --with-imagick=/opt/local
sudo make // fail with include error

Your real problem is Mac SIP (System Integrity Protection). 您真正的问题是Mac SIP(​​系统完整性保护)。 When SIP is enabled you can't write anything to /usr (with the exception of /usr/local). 启用S​​IP后,您将无法将任何内容写入/ usr(/ usr / local除外)。 Disable it and do the symlink, then try install Imagick wrapper using phpize. 禁用它并执行符号链接,然后尝试使用phpize安装Imagick包装器。 Make sure to re enable SIP after installation. 确保安装后重新启用SIP。

To disable SIP 禁用SIP

1)Reboot the Mac and hold down Command + R keys simultaneously after you hear the startup chime, this will boot OS X into Recovery Mode. 1)听到启动提示音后,重新启动Mac并同时按住Command + R键,这会将OS X引导到恢复模式。

2)When the “OS X Utilities” screen appears, pull down the 'Utilities' menu at the top of the screen instead, and choose “Terminal” 2)当出现“ OS X Utilities”屏幕时,请下拉屏幕顶部的“ Utilities”菜单,然后选择“ Terminal”

3)Type the following command into the terminal then hit return: 3)在终端中输入以下命令,然后按回车键:

csrutil disable; reboot

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM