You are here: Re: [PHP] Writing static file from dynamic PHP page « PHP « IT news, forums, messages
Re: [PHP] Writing static file from dynamic PHP page

Posted by Richard Lynch on 01/19/05 00:10

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация