Re: exec('make') Q
| From: | Richard Lynch | Date: | Wed, 24 Jan 2007 05:05:03 +0000 |
| Subject: | Re: exec('make') Q | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-247669@lists.php.net to get a copy of this message | ||
On Mon, January 22, 2007 5:45 pm, james@jwm-art.net wrote:
> Here's a simple makefile I want PHP's exec to execute make on:
>
> KEYLIST := keylist.txt
> DEPS := $(wildcard *.txt)
> FILES := *.txt
>
> $(KEYLIST): $(DEPS)
> grep ^keywords $(FILES) > $@
>
> now when I use make from command line, it works as expected,
> the keylist.txt file is created. however, when I use PHP exec
> to run make on the makefile, the keylist.txt file is not generated.
>
> * if keylist.txt does not need updating, PHP exec make works,
> make says keylist.txt is up to date.
> * if i remove redirection, PHP exec make shows that grep is
> making the same matches as make from commandline.
>
> Why does the redirection of the grep command (within the makefile)
> only work when I execute make from the commandline but not from
> PHP exec||shell_exec?
>
> One sollution is to abandon redirection and get the output from
> grep into a string and then get PHP to create keylist.txt, but
> why do that?
When your web-server runs PHP, it is NOT running as 'you'
It is running as a different user with different permissions.
Almost for sure, that user does not have permission to create files in
that directory.
This would exactly match the description you gave.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?