I was running a script in my browser which insert like some 100000 records in database. For some reason I deleted the file in which I have written script but it was little surprising for me that the scripts keeps inserting the records in the database even when the script doesn’t exist. Why is that?
Share
When a request is made to the web-server:
The PHP file is loaded into memory, it gets compiled and is running.
Since the file is in memory, any changes to file on disk is not applicable to running file.
If that strikes another question in you, as to “Why the hell it gets loaded into memory ?? Why can’t it be executed from the disk directly ?“:
Memory here is mostly the RAM, which is faster in doing read/write which is the need to compete with processors speed.
HardDisk is a slow memory and therefore, accessing from it, would make your programs very slow to execute.
To match with processors speed, there comes a need for a executable file to be loaded from Slow Memory (Often HardDisks) to a faster memory (Often Ram, or processor’s cache sometimes).
And therefore, the reason and answer, as to why your file on disk is not in sync file in memory.
Also please be assured, that this would be working fine in your next request!!
But if you still want to do it immediately, you can consider stopping/restart your Apache/IIS (whichever applicable) Server, as this will kill the process immediately.