php exec function multi line output doesnt work

I am using a 1&1 Business Linux package, with SSH access but no root access. I am trying to execute a ImageMagick conversion program within PHP through exec. I am trying to convert a PDF to a JPG, and I have ghostscript installed. I can execute the command successfully over SSH, but with PHP exec, the command does not complete the file conversion. I am wondering if this is because of the multiple warnings outputted when I convert the file. I think PHP is cutting out the command when the first error is printed rather than when the file is converted. How do I get PHP to complete the command, without cutting out? I can copy files between directories with the exec function.

Output of the command:

[code]**** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased {34 0 resolveR}] ****

**** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****

**** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****

**** This file had errors that were repaired or ignored.
**** The file was produced by:
**** >>>> Adobe PDF Library 7.0 <<<<
**** Please notify the author of the software that produced this
**** file that it does not conform to Adobe’s published PDF
**** specification.

How do I get php to allow the process to complete?

First of all: if your box allows PHP exec() functionality, you should rethink your security settings.

That being said, try echoing what is being executed. Perhaps PHP does cut it off. How long does the conversion take? If it takes more than 30 seconds, PHP might time it out. Try running it as a background process in that case (if you aren’t already).

Sponsor our Newsletter | Privacy Policy | Terms of Service