[Pugged] php system() command
Dave J. Hala Jr.
ciapug@ciapug.org
27 Aug 2002 13:45:09 -0500
Steve, R U really a Vorlon?
On Tue, 2002-08-27 at 13:15, Steve Langasek wrote:
>
> On Tue, Aug 27, 2002 at 05:38:02PM -0000, dave@visionary.com wrote:
> > I'm trying to run an external command for a pdf generator - it's the
> > Fytek "pdffile". We have an app that uses the win32 version. They
> > recently released a Linux version and we're trying to port it over.
>
> > The Fytek people don't know much about linux... their app is written in
> > Perl, and they used PerlApp to "compile" it into a binary.
>
> > I can run the "pdffile" binary from the command line and it generates
> > PDF's just fine.
>
> > I'm attempting to do it from PHP using this:
>
> > <?
> > system("pdffile source.rpt output.pdf");
> > ?>
>
> > I think the problem is that the binary is trying to use /root/tmp for
> > it's temporary files. Apache is running as nobody, and nobody can't
> > write to /root/tmp. (That doesn't sound grammatically correct...)
>
> > I've tried variations of this script with putting the full path in and
> > such... but here's the general idea:
>
> > #!/bin/bash
> > export TMP=/tmp
> > ./pdffile $1 $2
>
> > Again, I can run this from the cmd line and it works.
>
> > Any ideas on this?
>
> Best solution: fix the TMPDIR setting in Apache's environment, so that it
> doesn't think it should be using /root/tmp to begin with. This ought to
> be as simple as an 'unset TMPDIR' in your system's Apache startup script.
>
> I don't know why they suggested changing a variable named 'TMP'; the
> canonical Unix variable is 'TMPDIR'.
>
> Steve Langasek
> postmodern programmer