php – Imagick不打开“无法读取文件”异常的pdf文件
发布时间:2020-12-13 17:28:50 所属栏目:PHP教程 来源:网络整理
导读:试图从php脚本打开PDF文件会出现错误: Uncaught ImagickException: Failed to read the file in ... 我正在运行OS X,Brew,PHP 7.0,php70-imagick –HEAD,ImageMagick –with-ghostscript,GhostScript 命令行测试工作正常: convert 1.pdf 1.jpg 文件权限没
试图从php脚本打开PDF文件会出现错误:
Uncaught ImagickException: Failed to read the file in ... 我正在运行OS X,Brew,PHP 7.0,php70-imagick –HEAD,ImageMagick –with-ghostscript,GhostScript 命令行测试工作正常: convert 1.pdf 1.jpg 文件权限没问题.尝试使用具有realpath功能的URL和本地文件,因此filepath也可以.如果打开jpeg,脚本工作正常. phpinfo() -> ImageMagick supported formats: EPDF,PDF,PDFA,etc. 更新:解决了.解决方法如下
这个问题是与ghostscript的路径.它位于“/usr/local / bin”中,但Apache无法使用此路径. (phpinfo – > Apache环境 – > PATH)
解决方法是将符号链接文件转换为另一个路径: sudo ln -s /usr/local/bin/gs /usr/bin/gs OS X El Capitan注意! /usr/bin /在OS X 10.11中受到保护.您必须按照以下步骤操作: 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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |