osx - Ghostscript over PHP on Mac Yosemite doesn't work. On Shell it works -


i 'm despair...

i installed ghostscript on mac os x yosemite via homebrew. ghostscript works on shell, doesn't work, if executed via php.

$gs = '/usr/local/opt/ghostscript/bin/gs';  // count pdf $shell = $gs . ' -q    -dnodisplay    -c "(' . $pdf . ') (r) file runpdfbegin pdfpagecount = quit" 2>&1'; $result =  shell_exec($shell);  // execution $shell = $gs . ' -dnumrenderingthreads=4 -dnopause -sdevice=jpeg -dfirstpage=1 -dlastpage=1 -soutputfile="' . $filepaththumb . '" -djpegq=100 -r300 -q "' . $pdf . '" -c quit 2>&1'; $result =  shell_exec($shell); 

the output of $result is:

dyld: library not loaded: /usr/local/lib/libtiff.5.dylib referenced from: /usr/local/opt/ghostscript/bin/gs reason: incompatible library version: gs requires version 8.0.0 or later, libtiff.5.dylib      provides version 7.0.0 

if execute same command on shell works...

i tired many things in last days, still struggling.

i reinstalled gs , imagemagick, removed symlinks, runned brew doctor, tried other libtiff.5.dyslib files.

my environment:

  • yosemite
  • php version 5.5.13
  • zend server version: 7.0.0
  • imagemagick version 6.8.9-8 (installed via brew)
  • ghostscript version 9.15 (installed via brew)

clearly using version of ghostscript shared libraries (which why wants libtiff.dylib). don't recommend that, , avoid downloading ghostscript sources , building them yourself. 'some assembly required' project, need things gcc installed. managed , i'm far mac expert.

however, move on real underlying problem php environment not match shell. in case path environment variable different, means shell can find dynamic library, php can't.

since ghostscript can use environment variables, need make sure environment php script executes in same 1 shell uses.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -