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 Chris Bruce on 01/18/05 21:42

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??

On Jan 18, 2005, at 11:41 AM, Richard Lynch wrote:

>
>
>
>
> Chris Bruce wrote:
>> sorry for the repost, but my mail server was down from about 11pmEST
>> last night to 9:15am this morning and unable to receive responses. Can
>> someone forward me responses to this post if any? Thanks. Chris
>>
>>>> Hi,
>>>>
>>>> I am looking for a way to write to a file what the browser would see
>>>> (raw html) when viewing a dynamic PHP page. I have numerous include
>>>> files, MySQL db queries, loops etc. and I want to generate the
>>>> static
>>>> result of that file and save it as an html page. I have toyed a
>>>> little
>>>> with output buffering to no avail.
>>>>
>>>> Is there an easy way to do this?
>
> Just build the site you want with PHP, and then use wget to suck down
> the
> pages into your static directory.
>
> Output buffering should have worked, but it's too easy for somebody
> else
> to mess up the buffering if they want to use it for something else in
> their business logic.

 

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

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