[Pugged] php system() command
Steve Langasek
ciapug@ciapug.org
Tue, 27 Aug 2002 13:15:38 -0500
--da4uJneut+ArUgXk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
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
--da4uJneut+ArUgXk
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE9a8HJKN6ufymYLloRApu8AKCVeUyM0MvezsE2T9Iz5/C7zH7vIwCdEjRC
xbT4Xhn4+k6xi6lsMcc6H7w=
=tkVe
-----END PGP SIGNATURE-----
--da4uJneut+ArUgXk--