If I write the following script (not just in php but any server-side language really):
<?php
while (true)
{
sleep(4)
}
?>
and I then run the file with the linux terminal like so: php file.php
QUESTION: What would happen if I delete the file itself? Was the process first stored in ram, and now is executing regardless of the existence or non-existence of file.php
, would the process stop abruptly, or would something entirely different happen?
If it's already running, then it's already been loaded into memory, parsed and compiled, so it's running in memory.... deleting the file won't change that.... this is how compiled languages work, and contrary to many people's opinions, PHP is a compiled language.... it's compiled at execution time, and compiled to bytecode rather than to native machine code; but is still compiled nontheless