Re: Executing a PHP file to write an html file

From: Date: Mon, 02 Apr 2001 00:53:16 +0000
Subject: Re: Executing a PHP file to write an html file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-46534@lists.php.net to get a copy of this message
On Sun, 1 Apr 2001 03:06, PHP User wrote: > Here is my problem. > I have a file, static.php > static.php writes to index.html by way of... > $filename = "/web/h16/docs/index.html"; > $fp = fopen("$filename","w"); > fwrite($fp, "<table width=\"230\">\n"); > etc...... > > If I hit static.php from the command line, index.html gets written just > fine. static.php does it's job. > > If I try to exec(), or system() static.php from a browser the browser > just hangs. eg. I add: > system ('/usr/local/bin/php web/h16/docs/index.html); > or > exec ('/usr/local/bin/php web/h16/docs/index.html); > To a file and get nothing. I tried with and without the absolute paths > in the commands. > > What I want to be able to do is every time I update a Db, at the same > time I want the index page to be rewritten to reflect the changes in > the Db. And I don't want to have to go to the command line everytime I > want to rewrite the index page. So I would just hit "SAve" in the > update.php page, it would save to the Db, which it does now, and at the > same time it hits static.php and therefore rewrites index.html > > I also tried header() but that was no good due to echo in the pages, > gives that header already sent error. > > Is there a funtion I am missing somehwere that does the job? > > It's a Unix box running php 4.03, and the Db is MySQL > > Thanks Much!! Is it possible you have a permissions problem? Remember that your webserver will probably be running as something like nobody, which may not have the necessary permissions to wwrite to files in that particular directory. -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#46534) next »