I am running Symfony and Ghostscript and I cannot get shell_exec
to execute the script.
Simple test to make sure shell_exec()
works inside of Symfony: it works, I can see the directory structure
$output = shell_exec('ls') and output the results ...
From terminal: it works and it creates the PDF file
/usr/local/bin/gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=/file/path/file-c.pdf -dBATCH /file/path/file-a.pdf /file/path/file-b.pdf ...
From inside of Symfony: it does not work
$output = shell_exec('/usr/local/bin/gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=/file/path/file-c.pdf -dBATCH /file/path/file-a.pdf /file/path/file-b.pdf');
If I output the results print_r($output)
, I just get the following but file-c.pdf
is not created...
GPL Ghostscript 9.23 (2018-03-21) Copyright (C) 2018 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details.
If I do a "which gs" I get the following:
/usr/local/bin/gs
What could I be doing wrong in this example?
Why would it work from the terminal but fail in the shell_exec()
? I can run other commands from shell_exec()
and they work fine.