3

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.

1
  • 5
    Modifying an already parsed script during execution has no effect on the running process. Commented Jan 29, 2011 at 17:18

2 Answers 2

16

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

2 Comments

I don't think that will work, including the same file twice will just cause clashes with function and class names, etc
You have to deal with it, beware of function in this periodicaly included piece of code and other duplicated definition .. Dynamicaly included subprog is not good idea, but could solve sometimes thinks directly and easily.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.