Question

I have PHP application, that runs about 2-3 minutes before it return something to browser (some database processing stuff).

I want to know, if I can change php file with it while script is running. I assume, there is a buffer in Apache/PHP.

I have situation like this:

// This is index.php

include "DatabaseController.php"; // class inside, I create instance at start
include "ImagesController.php";  // class inside, I create instance at start
include "helpers.php"; // there are just functions, no classes

$db = new Database();
$img = new Images();

// for loop doing job here (2-3 minutes)

// end

What will happen, when I replace "DatabaseController.php" file while script is running?

I tried to test it, and it looks like "job part" is still using old version of DatabaseController, when I replace.

But... what will happen, when I replace "helpers.php" file? It contains only functions, without classes that may be instantiated at the beginning of script.

How this buffering works in general?

Was it helpful?

Solution

Its not really being buffered. You should read up on Compilers. In summary, the code you write will first need to be compiled before it can be executed. Changes you make to the source after it has been compiled will not take effect until the next request when it will be recompiled again.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top