Michael
Michael

Reputation: 6405

php change script while is running

I have a php script that I'm running from command line (e.g php test.php &). I would like to know if the execution is "flushed" automatically when I change some values in the script (using vim) while the script is running or if the script is somehow "cached" in the php engine when it starts running.

Upvotes: 3

Views: 2484

Answers (2)

include ($file) is included in time of execution.

If you have code for example

$i = 0;
while (true) {
 include('subprog.php');
 sleep(10);
 $i++;
}

and change subprog.php beetwen iteration, next iteration will use new subprog.php content.

Upvotes: 1

nicolaskruchten
nicolaskruchten

Reputation: 27370

While the script is running you can modify the file but it will not have any effect. The script is loaded once at execution-time.

Upvotes: 16

Related Questions