【发布时间】:2015-01-25 20:22:27
【问题描述】:
我很绝望……
我通过 Homebrew 在 Mac OS X Yosemite 上安装了 Ghostscript。 Ghostscript 在 shell 上运行良好,但如果通过 PHP 执行则无法运行。
$gs = '/usr/local/opt/ghostscript/bin/gs';
// Count PDF
$shell = $gs . ' -q -dNODISPLAY -c "(' . $pdf . ') (r) file runpdfbegin pdfpagecount = quit" 2>&1';
$result = shell_exec($shell);
// Execution
$shell = $gs . ' -dNumRenderingThreads=4 -dNOPAUSE -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -sOutputFile="' . $filePathThumb . '" -dJPEGQ=100 -r300 -q "' . $pdf . '" -c quit 2>&1';
$result = shell_exec($shell);
$result 的输出是:
dyld: Library not loaded: /usr/local/lib/libtiff.5.dylib
Referenced from: /usr/local/opt/ghostscript/bin/gs
Reason: Incompatible library version: gs requires version 8.0.0 or later, but libtiff.5.dylib provides version 7.0.0
如果我在 shell 上执行相同的命令,它就可以工作......
最近几天我累了很多东西,但我仍然在挣扎。
我重新安装了 gs 和 imagemagick,删除了符号链接,运行了 brew doctor,尝试了其他一些 libtiff.5.dyslib 文件。
我的环境:
- 优胜美地
- PHP 版本 5.5.13
- Zend 服务器版本:7.0.0
- Imagemagick 版本 6.8.9-8(通过 brew 安装)
- Ghostscript 9.15 版(通过 brew 安装)
【问题讨论】:
标签: php macos shell pdf ghostscript