Re: strange register_shutdown_function() and fopen() conflict

From: Date: Sun, 09 Sep 2001 00:52:40 +0000
Subject: Re: strange register_shutdown_function() and fopen() conflict
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-66562@lists.php.net to get a copy of this message
@fopen(...) or error_log("Unable to fopen: $php_errormsg"); Check your Apache log after this. http://php.net/error_log -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com 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 <kevin@gambitdesign.com> Newsgroups: php.general To: <php-general@lists.php.net> 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"); > > ?>

« previous php.general (#66562) next »