0

I'm attempting to run convert from exec inside a php function. No matter what I do convert never seems to run.

Heres my code:

exec( 'convert PANGO:"<span font_family="jeremy" size="126976">ac</span>" pango.png', $r, $t  );

Thanks!

Jeremy
  • 494
  • 1
  • 8
  • 20
  • what are $r and $t, what happens when you run that from the command line. Are you in windows or unix? – Richard Housham Jan 28 '19 at 20:54
  • It works fine through the command line. $r = Array(), and $t = 1. It's on centos. – Jeremy Jan 28 '19 at 22:05
  • Mmm, been a while from my php/linux days. Step 1 turn on all error reporting 2. I think there is a setting with PHP and permission to run the exec. 3. Permission on image magic make sure you can execute. 4. Toss in some verbose logging and output to file in that exec. Hopefully should get you going again – Richard Housham Jan 30 '19 at 00:08
  • Do you know how to turn on verbose for Imagick? I can't find anything. – Jeremy Jan 30 '19 at 21:11
  • Adding -verbose should help. https://imagemagick.org/script/identify.php Link here says that the convert should have magick before it. https://imagemagick.org/script/convert.php Also your php errors you can turn them on here. https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display Output to a file - should be just a case of adding '> /home/outputFile.txt' – Richard Housham Jan 31 '19 at 10:09
  • When I say, been a while we are talking years here. Like over 5 years and my linux is really rusty (it was never great). – Richard Housham Jan 31 '19 at 10:11
  • From the sound of things this seems like a PHP exec permissions problem though. It could be a case that it just doesn't have permission or that it can't find that exec.Just casting my mind back though and I remember that this kind of thing was discoraged as you are allowing users to run an exec command - which might open yourself up to hacks. I would probably say to Use a library (either image magick http://php.net/manual/en/book.imagick.php) or GD. There is a post here on your html to image http://buffernow.com/html-to-image-php-script/ which might also help. – Richard Housham Jan 31 '19 at 10:18

0 Answers0