Jump to content

Question about PHP file streams.


brendon

Recommended Posts

Guys,

 

Just a curious thought, will PHP fail if I was to write to a file (whether append, or overwrite) and there is currently an open read stream from another client? Or will PHP automatically handle this by, for example, waiting for any current streams to close?

 

Thanks,

Brendon

Link to comment
Share on other sites

Thanks for your input requinix.

 

For example, in the case of images, would it be best to implement caching, whereby a cached image would be returned to the client's browser if the original image was not readable (due to the file lock), or if the original image and the cached image had the same time stamp?

 

I'm guessing this would free up any opportunity to write to the original image? Or do you perhaps know of a better method than this?

 

Thanks,

Brendon

Link to comment
Share on other sites

Paranoid? Haha! I was just planning out a script and had a thought come to mind.

But I have worked around it after a few cups of coffee  :P

I have decided just to use caching to prevent any possible read/write collisions from occurring.

It's all good, thanks requinix for your help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.