Page 1 of 1

how to show IM error info in php?

Posted: 2011-02-14T21:00:05-07:00
by linjuming
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?

Image

Re: how to show IM error info in php?

Posted: 2011-02-14T21:24:31-07:00
by fmw42
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
?>

Re: how to show IM error info in php?

Posted: 2011-02-14T21:47:00-07:00
by linjuming
Thanks! i see now.

Re: how to show IM error info in php?

Posted: 2011-02-14T23:12:16-07:00
by anthony
How about stderr? :-)

Re: how to show IM error info in php?

Posted: 2011-02-15T00:15:47-07:00
by linjuming
Image

seems it doesn't work.

Re: how to show IM error info in php?

Posted: 2011-02-15T00:16:49-07:00
by linjuming
what is the meaning of "stderr" ?

Re: how to show IM error info in php?

Posted: 2011-02-15T01:00:17-07:00
by Bonzo
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?

Posted: 2011-02-15T01:12:52-07:00
by linjuming
thank you very much !