0
votes

So as described in question itself, I want to replace the file from which a zip archive is opened and then which is overwriting files with new version.

If still my question is not clear then the thing I want to do is I want to get a zip file from a server and then unzip using CLASS "ZipArchive" and then over write everyfile which is in Zip to destination location, the problem will be the php file by which this thing is happening will gonna be overwritten.

So will the php generate the error or the process will go whatever we want?

1
The operating system probably won't allow you to overwrite an open file. But, suck it & see. You are going to have to develop the unzip s/w anyway, it's only a question of where it writes to. So, code it up & try it.Mawg says reinstate Monica
no it completed successfullyuser8713979
wow, i think the php makes a cache file to save file to get corrupted, its a good thing. It was like overwriting variableuser8713979
The PHP script would have already been parsed into memory for execution.Scuzzy

1 Answers

1
votes

On Linux files are not usually locked (see https://unix.stackexchange.com/questions/147392/what-is-advisory-locking-on-files-that-unix-systems-typically-employs) so you can do whatever you want with that file. PHP works with that file in memory so you can overwrite it during it's execution.

But if you will run the script multiple times while the first one is in progress it might load incomplete version and then it will throw some error so it might be wise to make sure that won't happen (using locks) or try to do some more atomic approach.

Windows locks files so I assume you won't be able to extract files the same way there.