Forum Moderators: coopster
I'm running Apache with PHP 4.3.3 on OpenBSD 3.3 i386. In my case Apache (httpd) is chrooted to /var/htdocs/. So I figured I would have to copy ghostscript and all it's dependencies to /var/htdocs/ at least for it to work. Still nothing. Here's the code I used below. At this point I do not know what direction to go to get this to work or if it is even possible. I've tried exec(), system() and popen() api functions. I get nothing no results, no errors what so ever. BTW, ghostscript does appear to work fine in the chrooted directory via the console. At this point the below code is all I have. The sytax for ghostscript shown below just outputs the data of the 2 PDF files to the pdfwrite so it will merge them together into a merged.pdf file. Quite simple actually.
$szPipe = popen("/htdocs/gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=/htdocs/merged.pdf /htdocs/Sep08-113518.pdf
/htdocs/Sep08-113523.pdf", "r");
Any ideas or direction on how to do this would be greatly appreciated.
Thanks!
Yes gs is executable by the user that apache (httpd) runs as, www. I moved gs and all dependencies under /var/www/htdocs/ so it could be accessible.
vincevincevince
I tried using passthru() and it does not appear to do anything. When I echo it out it shows "127".
passthru("/htdocs/gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=/htdocs/merged.pdf /htdocs/Sep08-113518.pdf /htdocs/Sep08-113523.pdf", $szPipe);
[edited by: jatar_k at 3:15 pm (utc) on Sep. 10, 2003]
[edit reason] fixed sidescroll [/edit]
<?php
echo '<pre>';// Outputs all the result of shellcommand "ls", and returns
// the last output line into $last_line. Stores the return value
// of the shell command in $retval.
$last_line = system('ls', $retval);// Printing additional info
echo '
</pre>
<hr>Last line of the output: '.$last_line.'
<hr>Return value: '.$retval;
?>