I use exec function to debug the im code. but it can not show the error info,so if the code is not correct ,i must run in cmd to see the error info,it is painful for me every time. Is there any method to show the error info in php?
how to show IM error info in php?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how to show IM error info in php?
read up about exec function arguments, one is a message array.
try this
<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>
or
<?php
exec("/usr/local/bin/convert -list",$out,$returnval);
print_r($out);
?>
or use shell_exec as follows
<?php
$IM_version=shell_exec("/usr/local/bin/convert -version");
echo $IM_version
?>
try this
<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>
or
<?php
exec("/usr/local/bin/convert -list",$out,$returnval);
print_r($out);
?>
or use shell_exec as follows
<?php
$IM_version=shell_exec("/usr/local/bin/convert -version");
echo $IM_version
?>
Re: how to show IM error info in php?
Thanks! i see now.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: how to show IM error info in php?
How about stderr?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: how to show IM error info in php?
seems it doesn't work.
Re: how to show IM error info in php?
what is the meaning of "stderr" ?
Re: how to show IM error info in php?
This is what I do and uses stderr:
Code: Select all
<?php
$array=array();
echo "<pre>";
exec("convert null.png good.png 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
?>
Re: how to show IM error info in php?
thank you very much !