@fopen(...) or error_log("Unable to fopen: $php_errormsg");
Check your Apache log after this.
http://php.net/error_log
--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Kevin Bullaughey <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, September 07, 2001 6:16 PM
Subject: strange register_shutdown_function() and fopen() conflict
> scenario...
>
> i am trying to open a file from i function that is called automatically
> because it is registered with register_shutdown_function().
>
> for some reason i am unable to call fopen(). i am assuming that my script
> causes a fatal error and i cannot see the output because with apache, one
is
> not able to output at this stage.
>
> i'm running redhat linux roswell (7.2 beta), apache 1.3.19
>
> for the code that appears below, if i comment out the line:
> $testfp = fopen("test.txt", "w+");
>
> then i get the following output.txt file:
> opened output.txt successfully
> entered test_shutdown_function()
> failed to open test.txt
> end test_shutdown_function()
>
> if i don't comment out the line, then i get only this:
> opened output.txt successfully
> entered test_shutdown_function()
>
> any suggestions? my script must be terminating and i'm wondering why?
> i have tried to eliminate the possibility that fopen is failing for
ordinary
> i/o or permissions reasons.
>
> any ideas? or maybe just a hint as to how to debug this?
>
> here is the code....
>
> <?php
>
> function test_shutdown_function() {
> global $outfp;
> fputs($outfp, "entered test_shutdown_function()\n");
>
> $testfp = fopen("test.txt", "w+");
> if(!$testfp) {
> fputs($outfp, "failed to open test.txt\n");
> } else {
> fputs($outfp, "opened test.txt successfully\n");
> fputs($testfp, "opened test.txt successfully\n");
> }
> fputs($outfp, "end test_shutdown_function()\n");
> fclose($outfp);
> fclose($testfp);
> }
>
> global $output;
> $output = "initial value";
>
> $outfp = fopen("output.txt", "w+");
> if($outfp)
> fputs($outfp, "opened output.txt successfully\n");
> } else {
> fputs($outfp, "failed to open output.txt\n");
> }
>
> register_shutdown_function("test_shutdown_function");
>
> ?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]