Re: header and writing problem
| From: | Ernest E Vogelsinger | Date: | Wed, 26 Feb 2003 09:15:43 +0000 |
| Subject: | Re: header and writing problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137206@lists.php.net to get a copy of this message | ||
At 10:02 26.02.2003, George Pitcher said:
--------------------[snip]--------------------
>Hi all,
>
>Back on the list after a long break.
>
>I want to be able to write all my sql queries (well at least the ones that
>change or create records) to a log file.
>
>However some of the pages that contain these queries are just used to
>redirect the user depending on the result.
>
>Writing to a file id not permitted before creating the header for the
>redirect.
--------------------[snip]--------------------
This works for me:
<?php
$hf = fopen('cache/sample.txt', 'w');
fwrite($hf, 'Test');
fclose($hf);
header('Location: http://www.php.net/');
?>
(./cache is an apache-writable directory on my test server)
This seamlessly writes the file, then redirects to the requested site...
what errors do you get?
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/