Discussion Locked

PHP - Executing an external program

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello,
I'm somewhat new to using PHP in a UNIX
environment. I'm having trouble
running the ispell executable from within PHP.

From the shell, my command runs fine. Even
when I use the sudo command to
simulate the webserver's user.

My command is:

ispell -a -f /tmp/outfile < /tmp/infile

infile contains the text to be checked. When I
issue this command in the
shell, outfile is filled with the results of my
checking. However, when PHP
executes it, the outfile is generated but it's
blank.

I changed my command to this:

ispell -a -f /tmp/outfile < /tmp/infile &>
/tmp/error

when php executes this command, outfile is
created, outfile is empty, and
when I look at /tmp/error it says:

zsh: permission denied: ispell

Does anyone know what I'm doing wrong?

Thanks in advance,

-Mike

1 reply

by oscar

my first thought would be that the webserver (apache?) is running as a unprivileged user (nobody/nogroup), and that ispell is chmodded to only allow executing by certain users/groups.

btw, which function are you using to execute the command?

This discussion is closed to new replies.