Command run from php by apache doesn't work properly

Discussion in 'Apache' started by flashbck, Dec 19, 2008.

  1. #1
    I have a php script that uses ghostscript to convert the first page of a pdf file to a jpg image. When apache runs the php script, a different jpg file is produced than when I run the exact same command from the command line. The Apache version is blank whereas the command line version is the actual first page of the pdf file.

    This is the result of running gs -v:
    GPL Ghostscript 8.63 (2008-08-01)
    Copyright (C) 2008 Artifex Software, Inc. All rights reserved.

    The command I'm running is:
    /usr/local/bin/gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -r7 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dMaxStripSize=8192 -dFirstPage=1 -dLastPage=1 -sOutputFile="/path/to/webroot/output_file.jpg" "/path/to/webroot/pdfs/input_file.pdf"


    This isn't a permissions problem because apache saves the uploaded pdf file and owns the destination directory. I know that it will work properly because the conversion works seamlessly for most pdf file that I upload.
     
    flashbck, Dec 19, 2008 IP