Page 1 of 1

Certain command not working in exec()

Posted: Wed Feb 10, 2010 7:58 am
by BlurryDude
I have installed Ghost Script and Image Magick on my Windows server, and tested converting a pdf to image files via the command line.
This works fine. I have written the following script to allow users to upload PDFs and have the system automatically convert the file for them:

Code: Select all

 
$Xstring = "convert \"". $PDFfile ."\" -colorspace RGB -geometry 1024 \"output.png\"";
$tmp = exec($Xstring, $output);
 
Obviously there's more than that, but this is the only portion that is not working. If I run any other command in place of the convert command, it works fine,
this is the only command that is not working. I have set all of the permissions on all of the files and folders involved to allow the IUSR for this domain to
access them, but it still does nothing. The owrst part is that it returns no error, so I can't tell what's wrong. This is driving me crazy, any help would be GREATLY appreciated. Also, the full drive letter paths are present in the actual script, I excluded them here. If I run this command exactly as it is (without the escape characters of course) in command line, it works fine.

Re: Certain command not working in exec()

Posted: Wed Feb 10, 2010 8:54 am
by AbraCadaver
You're not showing the full paths, so they wouldn't happen to have a space in them would they? Like C:\Program Files\Something or similar?

Re: Certain command not working in exec()

Posted: Wed Feb 10, 2010 8:56 am
by BlurryDude
No. The full paths are like this: D:\vhosts\domain.com\httpdocs\file.pdf and D:\vhosts\domain.com\httpdocs\temp\output.png
with escape characters in the proper places of course.

Re: Certain command not working in exec()

Posted: Wed Feb 10, 2010 9:06 am
by BlurryDude
Also... Just thought of this...
If I use the command convert -version, it does in fact return version information to the $output array.

Can't do any different conversions either.. Tried on multiple folders, even tried on a folder with permission open to everyone, still nothing.

I even tried writting a batch file to execute the command for me, and executed the batch file from PHP, still didn't work. :banghead:

Re: Certain command not working in exec()

Posted: Wed Feb 10, 2010 2:46 pm
by BlurryDude
Not to necro a post or anything, but I just tried everything on a completely different machine, and it still does not work. DOes anyone have any insight about this? I have looked everywhere. I know it's not permissions issue becuase I can run opther commands just fine, and on the new system the processes are actually being run by the system account itself, and I can enter the command into the command line manually and the software works, so I'm not sure what the deal is.

Re: Certain command not working in exec()

Posted: Mon Feb 15, 2010 9:26 am
by BlurryDude
Ok, since no one seems to know the answer to my problem, let's try this...
I need to upload a PDF and have my server automatically break it down into images that can then be passed into a flash object that will enable the user
to flip through the pages as if it were a book. I have the flash part of it working, I just need to break the PDF down into images. Any suggestions?