I am trying to run a CLI command with a PHP script:
in particular, I want to use this command convert a.png a.tifto convert an image to tiff.
When I run this command from the CLI, it works as expected, but if I run with a PHP script with the following code, it does not create any tiff image in my folder:
$exec = "convert a.png a.tif";
exec($exec,$yaks,$err);
echo "<pre>";
print_r($yaks);
echo "$err";
echo "</pre>";
Moreover, it is $yaksempty, but $err- 127.
I am not an expert, why does this not work as expected?
Regards
UPDATE
I used this command instead $exec = "convert 4.png 4.tif 2>&1";, and I got back[0] => sh: convert: command not found
It seems strange to me, because I can use it from the CLI!
FINAL UPDATE
Thanks a lot guys!
$exec = "/usr/local/bin/convert a.png a.tif";
This team solved the problem! You are wonderful.