Page 1 of 1

path problems

Posted: 2010-04-29T09:36:00-07:00
by ebgb
got around my previous probs but have come up against another one!
I'm executing via php using shell_exec()

if I run

Code: Select all

shell_exec(convert  -density 175 myfile.pdf  myfile.png)
from php....

I get a lovely png in the same directory as the pdf, which is cool

what I want is the converted file to be saved elsewhere, if I run the following directly in a terminal it works fine, saves the png elsewhere as expected:

Code: Select all

convert  -density 175 /home/kelldap/public_html/PDF/myfile.pdf  /home/kelldap/public_html/appro_png/myfile.png

but if run that through php like this

Code: Select all

shell_exec(convert  -density 175 /home/kelldap/public_html/PDF/myfile.pdf  /home/kelldap/public_html/appro_png/myfile.png)
server is running fedora 8 with the latest IM and ghostscript


the browser spins for a bit as though it is doing the conversion, but there is no file saved in the destination folder

server is running fedora 8 with elatest IM and ghostscript installed

but when I run the above locally on my little ubuntu box thats sat on my desk it runs perfectly, but not on the fedora remote server

Re: path problems

Posted: 2010-04-29T10:54:31-07:00
by Bonzo
Not sure what your problem is but try:

1/ Using "" around your command

Code: Select all

shell_exec("convert  -density 175 /home/kelldap/public_html/PDF/myfile.pdf  /home/kelldap/public_html/appro_png/myfile.png")
2/ I assume the folder appro_png is CHMOD to 777

3/ Display any errors returned with

Code: Select all

$array = array();
echo "<pre>";
shell_exec("convert  -density 175 /home/kelldap/public_html/PDF/myfile.pdf  /home/kelldap/public_html/appro_png/myfile.png 2>&1", $array); 
echo "<br>".print_r($array)."<br>"; 
echo "</pre>";
4/ I use realtive paths and exec()