Jump to content

Handling files


urosh

Recommended Posts

Hi all, i am new with PHP, and i would like to know if it is possible to use one file by two different functions at the same time. That is, one function will read information from the top of the file, while second function will add information on the bottom of the file. Second function is much faster in its job so ther is no problem that first function will come to the end of the file before second function finish its work.

Is this possible, or i need to break the file into more files that will be approached by only one function at the time?

Thanks in advance
Urosh
Link to comment
Share on other sites

Litle clarification. Actually these two functions are two executables. First executable put some information into the file, while second one reads information from the file, and do some work. As second executable is much slower, idea is to try to save some time, by getting available information as soon as it is available. If anyone have an idea if that is possible?
Link to comment
Share on other sites

I am trying to run two executables at the same time, by forking processes it should be possible? Andif it is possible, i want them to use the same file at the same time, that is one to read from the file, one to write to the file.
Link to comment
Share on other sites

What you're asking can be done with PHP in a *nix environment outside of a webserver.  A quick google search yielded this site: http://www.electrictoolbox.com/article/php/process-forking/ which might be of help to you.  Honestly though, PHP probably isn't the best solution I think you'd be better off with a language that supports threading i.e., Java.

Best,

Patrick
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.