I'm trying to create a small web service to convert PDF files to a series of images.
When I run convert /full/path/to/source.pdf full/path/to/target.jpg
when connected to the [Mediatemple (gs)] server via ssh, everything works correctly.
When executing the same command through PHP's exec()
function, only the first few pages of the PDF file get converted. Sometimes the remaining pages are 0-length jpg files, sometimes they don't appear at all.
Also, the bottom area of the first pages is sometimes black, as if convert stopped half-way on the page.
What could be causing this problem?
UPDATES:
I'm using set_time_limit(0).
If I'm connected via SSH, and run the command convert -limit area 90 ...
, it completes successfully in approx. 30 seconds. When doing the same via PHP-s exec(), it runs for ~90 seconds and produced broken images (as described above) as output.
Is there a simple way to make the convert task run with the same privileges and resources as from SSH?
Also, since it must be really frustrating working around a server problem I have little control over -- is there a good existing web service (API) that would convert PDFs to images?