Imagick don't open pdf files with “Failed to read the file” exception

送分小仙女□ 提交于 2019-12-01 03:47:47

This problem was with path to ghostscript. It's locate in "/usr/local/bin", but this path is not available to Apache. (phpinfo -> Apache Environment -> PATH)

Solution is to symlink file to another path:

 sudo ln -s /usr/local/bin/gs /usr/bin/gs

OS X El Capitan Note! /usr/bin/ in OS X 10.11+ is protected. You have to follow this steps:

1. Reboot to Recovery Mode. Reboot and hold "Cmd + R" after start sound.
2. In Recovery Mode go to Utilities -> Terminal.
3. Run: csrutil disable
4. Reboot in Normal Mode.
5. Do the "sudo ln -s /usr/local/bin/gs /usr/bin/gs" in terminal.
6. Do the 1 and 2 step. In terminal enable back csrutil by run: csrutil enable

Here is an better way of updating the Apache path variable on OS X which doesn't require symlinking (and therefore no need to disable SIP):

https://www.euperia.com/development/solved-php-imagick-unable-to-open-image-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!