在 OS X Lion 上编译适用于 XAMPP 1.7.3 的 PHP Imagick 扩展
我在 OS X Lion 上编译 PHP Imagick 扩展并使用 XAMPP 1.7.3 运行时遇到一些问题。
启动 Apache 时,我的 PHP 错误日志中出现以下错误(并且该扩展未显示在 phpinfo()
输出中):
[16-Aug-2011 12:42:31] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/imagick.so' - dlopen(/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/imagick.so, 9): no suitable image found. Did find:
/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/imagick.so: mach-o, but wrong architecture in Unknown on line 0
我安装了 XAMPP 开发包。
我使用 Homebrew 安装 Imagick 6.7.1-1:
brew install imagemagick
brew link imagemagick
要安装 Imagick 扩展,我使用了 XAMPP 提供的 PECL:
cd /Applications/XAMPP/xamppfiles/bin
sudo ./pecl install imagick
当提示输入 ImageMagick 的位置时,我尝试了以下路径(结果相同):
/usr/local/bin
/usr/local/Cellar
您可以看到整个此处输出: https://gist.github.com/1149849
另外我尝试从 PECL 网站获取 Imagick PECL(3.0.1 和 3.1.0b)tar 并从头开始编译:
/Application/XAMPP/xamppfiles/bin.phpize
./configure --with-imagick=/usr/local/bin --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config-5.3.1
make
sudo make install
make test
您可以在此处看到输出:https://gist.github.com/1149875
我在各个网站上偶然发现了一些关于这个主题的文章,但没有一篇能帮助我解决这个问题。
我还尝试了 MacPorts for ImageMagic,得到了相同的结果(在编译期间使用 /opt/local
作为路径)。
任何建议将不胜感激。
注意:郑重声明,我可以在另一台 OS X Lion 计算机上重现此问题。
I'm having some trouble getting the PHP Imagick extension compiled and running with XAMPP 1.7.3 on OS X Lion.
I get the following error in my PHP error log when launching Apache (and the extension doesn't show in the phpinfo()
output):
[16-Aug-2011 12:42:31] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/imagick.so' - dlopen(/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/imagick.so, 9): no suitable image found. Did find:
/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/imagick.so: mach-o, but wrong architecture in Unknown on line 0
I installed the XAMPP development package.
I used Homebrew to install Imagick 6.7.1-1:
brew install imagemagick
brew link imagemagick
To install the Imagick extension I used PECL provided with XAMPP:
cd /Applications/XAMPP/xamppfiles/bin
sudo ./pecl install imagick
When prompted for the location of ImageMagick I've tried the following paths (with the same result):
/usr/local/bin
/usr/local/Cellar
You can see the entire output here: https://gist.github.com/1149849
Additionally I tried grabbing the Imagick PECL (3.0.1 and 3.1.0b) tar from the PECL website and compiling from scratch:
/Application/XAMPP/xamppfiles/bin.phpize
./configure --with-imagick=/usr/local/bin --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config-5.3.1
make
sudo make install
make test
You can see the output here: https://gist.github.com/1149875
I've stumbled across a few articles about this topic on various website, none of which have helped me resolve it.
I've also tried MacPorts for ImageMagic, with the same result (using /opt/local
as the path during compile).
Any advice would be greatly appreciated.
Note: For the record, I'm able to reproduce this issue on another OS X Lion machine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PHP 警告:PHP 启动:无法加载动态库“../imagick.so”{Snip}....未找到合适的图像。是否发现:
imagick.so:mach-o,但第 0 行未知的架构错误
它清楚地表明,扩展在那里,但架构与您的内核不同。也许您已启动至 64 位内核并尝试运行 32 版本,反之亦然。
只需使用正确的架构启动内核
[1] Mac OS X v10.6:使用 32 位或64位内核
PHP Warning: PHP Startup: Unable to load dynamic library '../imagick.so' {Snip}....no suitable image found. Did find:
imagick.so: mach-o, but wrong architecture in Unknown on line 0
It clearly says, the extension is there but architecture is not same your kernel. perhaps you are booted into 64bit kernel & trying to run 32version or vice versa.
Just boot into kernel with correct arch
[1] Mac OS X v10.6: Starting up with the 32-bit or 64-bit kernel