Case:
I have a PHP script that is currently being executed by many users.
This script takes some time to complete (say, fetch data from browser, process it, update database etc.)
Now I modified the script and I upload it to the server using a FTP client. The FTP client happily uploads it and says uploaded.
Now what really happened here?
When I uploaded the modified script, what happened to current executions?
The possibilities I came up with are:
1) All the current executions are screwed.
The executions stopped when the new script was uploaded.
If this is the case (which I pray is not) how can a script be uploaded to the server without affecting the current executions?
2) The current executions are completed with the old script. When a new request comes, it's processed with the new modified script.
3) Something else?
Let's say you have index.php which does some intensive calculations, taking a decent amount of time, and then makes a call to process.php
A visitor comes to your website and loads up index.php. This is loaded into memory by your web server software (Apache, nginx, IIS etc) and served to your visitor. While your visitor is running those calculations on index.php you decide to upload updated versions of both index.php and process.php. At this point in time your visitor will keep running the old version of index.php and they will not see the new version until they refresh the page.
They will however see the new version of process.php after the old version of index.phpmakes a call to it. This is because the server reads whatever file is called, loads it up into memory and serves it to the user creating a session between the server and the user. If the user attempted to get process.php or index.php while it was partially uploaded they will get an error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With