ID:               26513
 Updated by:       [EMAIL PROTECTED]
 Reported By:      fgasper at freeshell dot org
-Status:           Open
+Status:           Feedback
 Bug Type:         CGI related
 Operating System: FreeBSD 4.9
 PHP Version:      4.3.4
 New Comment:

Try running gs binary directly instead of using the wrapper shell
scripts. (in my system ps2pdf first calls ps2pdf12 which calls ps2pdfwr
which calls the gs binary with appropriate options)

And check the execute permissions on all those scripts..?
Try running the command with this:

exec ($cmd, $output, $retval);

Then you can check what the command returns as retval in $retval.




Previous Comments:
------------------------------------------------------------------------

[2003-12-03 15:19:26] fgasper at freeshell dot org

I tried changing the exec line to:

----------
print system("/usr/local/bin/ps2pdf /tmp/fshn.ps");
----------

Also tried running this on a Gentoo box that I have which runs PHP
4.3.2. These revealed the following:

1) The Gentoo box gives two iterations of
"**** Unable to open the initial device, quitting."
upon execution via CGI. Not sure why this is, but it doesn't seem to be
related to this particular problem because...

2) CGI from the FreeBSD box gives no response at all from the system()
command.

3) The CLI mode in Gentoo works fine, just as it does in FreeBSD.

------------------------------------------------------------------------

[2003-12-03 14:48:44] fgasper at freeshell dot org

Description:
------------
I am producing PostScript reports from a database application with PHP.
Since most of my users won't have GhostScript or anything like that
installed, I want to display the reports as PDFs. My problem is that
ps2pdf doesn't appear to be executing.

I tried running my script in CLI mode, though, and it worked just
fine.

The code example below illustrates the problem. I have its output
here:

CGI/Apache: --------------------
1070480700.11
-rw-r--r--  1 fgasper  wheel  1440973 Dec  3 13:25 /tmp/fshn.ps

1070480700.12
-rw-r--r--  1 fgasper  wheel  1440973 Dec  3 13:25 /tmp/fshn.ps


CLI: -------------------
1070480804.37
-rw-r--r--  1 fgasper  wheel  1440973 Dec  3 13:25 /tmp/fshn.ps

1070480818.42
-rw-r--r--  1 fgasper  wheel  1440973 Dec  3 13:25 /tmp/fshn.ps

Reproduce code:
---------------
<?php

header('Content-type: text/plain');

print array_sum(explode(" ",microtime()))."\n";
system('ls -la /tmp/fshn*');
print "\n";

exec('/usr/local/bin/ps2pdf /tmp/fshn.ps');

print array_sum(explode(" ",microtime()))."\n";
system('ls -la /tmp/fshn*');
print "\n";

?>


Expected result:
----------------
1070480804.37
-rw-r--r--  1 fgasper  wheel  1440973 Dec  3 13:25 /tmp/fshn.ps

1070480818.42
-rw-r--r--  1 fgasper  wheel  1440973 Dec  3 13:25 /tmp/fshn.ps

Actual result:
--------------
1070480700.11
-rw-r--r--  1 fgasper  wheel  1440973 Dec  3 13:25 /tmp/fshn.ps

1070480700.12
-rw-r--r--  1 fgasper  wheel  1440973 Dec  3 13:25 /tmp/fshn.ps


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26513&edit=1

Reply via email to