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....


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");

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");


PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to