Chris Bruce wrote:
> This is a great solution, except I cannot get PHP to exec the file that
> has the 'wget' command in it.
>
> What I have done is to create a file (wget.php) into the directory that
> I want to wget the page into. I then chmod -R the directory to make
> everything in it executable.
> here is what is written to the file:
> /usr/bin/wget -d http://path/to/file/index.html
>
> Then in the PHP function I make a an exec call on that file
> exec(/path/to/file/wget.php,$out,$err);
>
> Everything is cool, except the exec does not happen. The $out array
> looks like this:
> Array
> {
> }
> and the $err returns '126'
>
> But the exec doesn't happen. If I run the contents of wget.php on the
> command line, presto, it works.
>
> So, what is the deal? Is it a problem with the apache user not having
> access to wget through PHP??

Almost for sure, yes.

Though you've now made it even more complex, because maybe the PHP user
doesn't have eXec priveleges for your 'wget.php' file, in addition to not
having eXec priveleges to 'wget' in /usr/bin

Plus, having PHP able to write the file, and PHP able to eXec the file,
wget.php, would be a pretty gaping security hole on a shared server...

You've got to make it possible for the PHP user to:
A) eXec wget
B) Write into the output directory wget will use

Honestly, though, wget is *SO* easy, you may want to bypass PHP for that
part of it anyway -- A cron job to wget the site or a simple shell script
might be easier to work with than running PHP to run wget...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to