Page 1 of 1

Debug isn't working

Posted: 2015-06-02T02:36:37-07:00
by c0d3n4m3
Hi all,

I've been running IM through PHP using the exec() command as I am on shared hosting.

Now, I'm currently trying to get '-debug all' to work, but no matter what I do, I don't get anything back. Nothing. I am trying to use this in conjuction with an image cropper and this is why I need to see the debug logs so I can at least see where it's failing.

Is there something that can prevent -debug outputting it's logs? This is the exec I am using (note the cropping parameter is left out):

Code: Select all

exec(convert -debug all images/site_content/approved_stamp.jpg images/site_content/approved_stamp22.tiff);
I've lost a day on trying to get -debug to work, but to no avail! Please, please does anyone know why I'm not getting any debug logs or output?

Thank you!

Re: Debug isn't working

Posted: 2015-06-02T02:47:32-07:00
by snibgo
Debug output goes to stderr, not stdout. Are you reading the correct channel?

Re: Debug isn't working

Posted: 2015-06-02T03:03:58-07:00
by c0d3n4m3
This is going to sound incredibly n00bish, but stderr, would that be my general error_log.txt file, that generates whenever there is a php error. Like "Undefined Variable" etc, or is stderr different? If so, how can I read the stderr channel?

Also, thank you graciously for your fast reply!



EDIT: I think I have it: at the end of my exec() call, I added this: '2>&1' and I'm getting this outputted now:

Code: Select all

convert -debug all images/site_content/approved_stamp.jpg images/site_content/approved_stamp22.tiff 2>&1
2015-06-02T11:12:37+01:00 0:01 0.000u 6.5.4 Configure convert[303230]: utility.c/ExpandFilenames/866/Configure
  Command line: convert {-debug} {all} {images/site_content/approved_stamp.jpg} {images/site_content/approved_stamp22.tiff}
2015-06-02T11:12:37+01:00 0:01 0.000u 6.5.4 Configure convert[303230]: configure.c/GetConfigureOptions/528/Configure
  Searching for configure file: "/opt/cloudlinux/share/ImageMagick-6.5.4/config/coder.xml"
2015-06-02T11:12:37+01:00 0:01 0.000u 6.5.4 Configure convert[303230]: configure.c/GetConfigureOptions/528/Configure
  Searching for configure file: "/opt/cloudlinux/lib/ImageMagick-6.5.4/config/coder.xml"
2015-06-02T11:12:37+01:00 0:01 0.000u 6.5.4 Configure convert[303230]: configure.c/GetConfigureOptions/528/Configure
  Searching for configure file: "/opt/cloudlinux/share/doc/ImageMagick-6.5.4/coder.xml"
2015-06-02T11:12:37+01:00 0:01 0.000u 6.5.4 Configure convert[303230]: configure.c/GetConfigureOptions/528/Configure
  Searching for configure file: "/opt/cloudlinux/share/ImageMagick-6.5.4/coder.xml"
2015-06-02T11:12:37+01:00 0:01 0.000u 6.5.4 Configure convert[303230]: coder.c/LoadCoderList/639/Configure
  Loading coder configuration file "/opt/cloudlinux/share/ImageMagick-6.5.4/config/coder.xml" ...
2015-06-02T11:12:37+01:00 0:01 0.000u 6.5.4 Module convert[303230]: module.c/OpenModule/1154/Module
  Searching for module "JPEG" using filename "jpeg.la"
2015-06-02T11:12:37+01:00 0:01 0.000u 6.5.4 Module convert[303230]: module.c/GetMagickModulePath/549/Module
  Searching for coder module file "jpeg.la" ...
2015-06-02T11:12:37+01:00 0:01 0.000u 6.5.4 Module convert[303230]: module.c/OpenModule/1163/Module
  Opening module at path "/opt/cloudlinux/lib/ImageMagick-6.5.4/modules-Q16/coders/jpeg.la"
2015-06-02T11:12:37+01:00 0:01 0.000u 6.5.4 Module convert[303230]: module.c/OpenModule/1190/Module


I'm assuming I've now got the debugging logs working?

Re: Debug isn't working

Posted: 2015-06-02T03:24:56-07:00
by snibgo
Sorry, I don't know PHP, but it would be something like:

Code: Select all

exec("convert -debug all images/site_content/approved_stamp.jpg images/site_content/approved_stamp22.tiff 2>&1", $err_output);

Re: Debug isn't working

Posted: 2015-06-02T03:26:44-07:00
by c0d3n4m3
Yeah, fantastic, thank you ever so much for your help! Much kudos to you!