问题描述
我正在尝试使用MAMP 3.0.5将PDF转换为png文件。我知道我的PHP代码在我们的Linux服务器上正常工作...
Im trying to convert a PDF to a png file using MAMP 3.0.5. I know that my PHP code works as it works fine on our Linux server...
我在Mac OSX 10.8.5上安装了MAMP 3.0.5,当我运行脚本将PDF转换为png文件我收到以下错误:
I have setup MAMP 3.0.5 on my Mac OSX 10.8.5 and when I run the script to convert the PDF to png file I get the following error:
请帮忙,这让我抓狂!
推荐答案
This might help. I just ran into the same issue and solved it a few hours later.
我的第一直觉是确保PHP正在寻找正确的PATH。对我来说,就是这样:
My first instinct was to make sure PHP was looking at the right PATH. For me, it was this:
putenv('PATH=' . getenv('PATH') . ':/usr/local/bin');
这似乎没有任何帮助,但我把代码留在那里,因为在某些点GhostScript需要知道在哪里找到这些libpng文件。
That didn't seem to help on its own, but I left the code in there because at some point GhostScript is going to need to know where to find those libpng files.
我的下一步是检查MAMP的Apache错误日志。我发现这可能是罪魁祸首:
My next step was to examine MAMP's Apache error log. I found this as the probable culprit:
dyld: Library not loaded: /usr/local/lib/libpng16.16.dylib
Referenced from: /usr/local/bin/gs
Reason: Incompatible library version: gs requires version 29.0.0 or later, but libpng16.16.dylib provides version 23.0.0
很奇怪,因为我的/ usr / local / lib中的libpng是最新的(1.6.12)。
Very strange, because my libpng in /usr/local/lib is up to date (1.6.12).
经过多次试验和错误,我发现从3.0.5开始,MAMP在/ Applications / MAMP / Library / lib中覆盖了自己的libpng文件
After much trial and error, I found that as of 3.0.5, MAMP is overriding with its own libpng files, in /Applications/MAMP/Library/lib
我从/ Applications / MAMP / Library / lib中删除了libpng16.16.dylib,重新启动了MAMP,再次尝试,并收到此错误:
I removed libpng16.16.dylib from /Applications/MAMP/Library/lib, restarted MAMP, tried again, and got this error:
dyld: Library not loaded: /usr/local/lib/libfreetype.6.dylib
Referenced from: /usr/local/bin/gs
Reason: Incompatible library version: gs requires version 18.0.0 or later, but libfreetype.6.dylib provides version 17.0.0
嗯,这是不同的,所以我从/ Applications / MAMP / Library / lib中删除了libfreetype.6.dylib,并重新启动了MAMP。
Well that's something different, so I removed libfreetype.6.dylib from /Applications/MAMP/Library/lib as well, and restarted MAMP.
此时,一切都开始起作用了。至少对我来说,两个步骤是确保PHP的PATH正在查看正确的目录,然后从MAMP包含的libpng库中删除有问题的文件,迫使PHP使用/ usr /中的最新libpng文件local / lib。
At this point, everything began working. At least for me, the two steps were to make sure PHP's PATH is looking at the right directory, and then to remove the offending files from MAMP's included libpng library, forcing PHP to use the up-to-date libpng files in /usr/local/lib.
这篇关于在MAMP 3.0.5上,消息Postscript委托的ImagickException失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!