简体   繁体   English

在 PHP 脚本中使用 exec(convert) 时出现错误“转换:找不到命令”

[英]Error 'convert: command not found' when using exec(convert ) in PHP script

I have installed my development server on my mac我已经在我的 Mac 上安装了我的开发服务器

Catalina 10.15.4
Apache (homebrew) => 2.4.43
PHP (homebrew) => 7.2.29
MySQL => 5.7.28

Imagemagick (homebrew) => 7.0.10
Imagick (homebrew) => 3.4.4

All Works perfectly!所有作品完美! Except when i use imagemagick on a php script:除非我在 php 脚本上使用imagemagick

exec('convert -version', $debug, $return);

I get the error:我得到错误:

sh: convert: command not found

But when I do it on the mac Terminal, convert -version , it works: I get:但是当我在 mac 终端上执行时convert -version ,它可以工作:我得到:

Version: ImageMagick 7.0.10-0 Q16 x86_64 2020-04-04 https://imagemagick.org
Copyright: © 1999-2020 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(3.1) 
Delegates (built-in): bzlib freetype gslib heic jng jp2 jpeg lcms ltdl lzma openexr png ps tiff webp xml zlib

I've read the following post and wasn't able to fix it我已阅读以下帖子但无法修复

https://stackoverflow.com/questions/28627473/error-for-convert-command-in-command-line

I did the following on the mac Terminal: which convert and I get:我在 mac 终端上做了以下操作: which convert我得到:

/usr/local/bin/convert

My path looks like this:我的路径如下所示:

PATH=/usr/local/opt/php@7.2/sbin:/usr/local/opt/php@7.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

When I open my phpinfo, I see the imagick, but not imagemagick, like so当我打开我的 phpinfo 时,我看到了 imagick,但没有看到 imagemagick,就像这样

phpinfo

At this point, I'm not sure what is the problem.在这一点上,我不确定是什么问题。 Any ideas what it could be?有什么想法吗?

Use /usr/bin/magick instead.请改用/usr/bin/magick

convert is deprecated in v7+ if I am not mistaken.如果我没记错的话,在 v7+ 中不推荐使用convert

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM