strange register_shutdown_function() and fopen() conflict

From: Date: Fri, 07 Sep 2001 23:16:15 +0000
Subject: strange register_shutdown_function() and fopen() conflict
Groups: php.general 
Request: Send a blank email to php-general+get-66498@lists.php.net to get a copy of this message
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"); ?>

« previous php.general (#66498) next »