From: fgasper at freeshell dot org
Operating system: FreeBSD 4.9
PHP version: 4.3.4
PHP Bug Type: CGI related
Bug description: ps2pdf command works in CLI, not CGI
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 bug report at http://bugs.php.net/?id=26513&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26513&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26513&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26513&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26513&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26513&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26513&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26513&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26513&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26513&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26513&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26513&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26513&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26513&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26513&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26513&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26513&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26513&r=float