Debug isn't working

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
c0d3n4m3
Posts: 3
Joined: 2015-06-02T02:09:48-07:00
Authentication code: 6789

Debug isn't working

Post 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!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Debug isn't working

Post by snibgo »

Debug output goes to stderr, not stdout. Are you reading the correct channel?
snibgo's IM pages: im.snibgo.com
c0d3n4m3
Posts: 3
Joined: 2015-06-02T02:09:48-07:00
Authentication code: 6789

Re: Debug isn't working

Post 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?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Debug isn't working

Post 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);
snibgo's IM pages: im.snibgo.com
c0d3n4m3
Posts: 3
Joined: 2015-06-02T02:09:48-07:00
Authentication code: 6789

Re: Debug isn't working

Post by c0d3n4m3 »

Yeah, fantastic, thank you ever so much for your help! Much kudos to you!
Post Reply