Exec command doesn't work as expected

后端 未结 3 459
栀梦
栀梦 2021-01-07 00:31

I\'m trying to launch a CLI command from a PHP script:

in particular I wanna use this command convert a.png a.tif to convert an image to tiff.

W

相关标签:
3条回答
  • 2021-01-07 01:12

    The PHP script probably doesn't know where to find these things you're referring to in the exec command. When you run this from the command line, the shell will look for them in the directory you are in at that point in time; but when you run it from PHP, it probably defaults to the PHP dir and not the specific dir in which your files are. So write out the full path.

    0 讨论(0)
  • 2021-01-07 01:14

    you should enter fullpath to "convert" and may be files.

    err 127 - file not found

    0 讨论(0)
  • 2021-01-07 01:22

    It looks like the 'convert' binary isn't in any of the directories on the PATH PHP is using. You could try using the full path, e.g. /opt/local/bin/convert or whatever the path is.

    You could also modify the PATH used by PHP (but I don't know how).

    0 讨论(0)
提交回复
热议问题