How to change class file realtime and use it in conditional statements?

I have a php project and i want it to be installable like cms so first thing i did was to work with installation. i created a “Appconfiguration.php” the content of that was this.

    <?php
      class AppConfig
      {
         $appstatus=0;
      }
    ?>

i have a form that validates if the key is valid then the “$appstatus” variable will be updated into ‘1’ i did that with this code.

$myfile = fopen("../Appconfiguration.php", "w") or die("Unable to open file!");

$txt =

"

<?php
    class App
    {
        public /$appstatus=1;
    }

?>

";

    $data=stripslashes($txt);

    fwrite($myfile, $data);

    fclose($myfile);

yey i updated the file but as you can see i just overide it with a string. but thats not the problem. im happy that it work but my conditional statement on my index.php redirect me always in installation page even tho the class was updated. it looks like my index doesn’t read the class. so i did troubleshooting . i comment the index.php contents then echo the class variable it displays right! but how come the simple conditional state doesnt read it!? help me pleasssseeeee by the way. the “Appconfiguration.php” is included on my index so there is no way that the index file cant read the AppConfiguration.php why my conditional statement failed:(

this is the conditional statement

        include('Appconfiguration');
        $myappConfig= new App;
        $status=$myappConfig->appstatus;
      if($status==0)
      {
         header('location:installation/');
      }
      else
      {
         header('location:files/');
      }
    ?>

please help im newbee at file bendering haha (avatar sh*t) Lol thanks in advance!!!