Web Hosting Talk







View Full Version : commandline php


amberlong83
12-21-2009, 05:58 AM
Hello Everyone

I have a php script that runs for about 30 minutes.

I'm calling the script every minute from the command line using cron.

I want multiple instances of the same script running concurrently without one interfering with the other?

What I want to do is to be able to run a new instance each minute, and not have the new instance interfere with currently running processes.

For example, if one process generates a random password $password, would that value be affected if another process generates it's own $password?

Thanks in Advance

xtrac568
12-21-2009, 08:23 AM
it depends on what the script does, but the general answer to your question about $password is no, each process has it's own $password.

mattle
12-21-2009, 11:42 AM
For example, if one process generates a random password $password, would that value be affected if another process generates it's own $password?

Only if you were going way out of your way to do some shared memory allocation. I don't even know if you can do that in PHP, but believe me, if you were doing it, you'd know it!

The short answer to your question is "no," each process exists independently in its own memory space.

Obviously, if you're doing DB updates or file writing, then you have to be concerned with concurrency.

amberlong83
12-23-2009, 04:19 AM
Only if you were going way out of your way to do some shared memory allocation. I don't even know if you can do that in PHP, but believe me, if you were doing it, you'd know it!

The short answer to your question is "no," each process exists independently in its own memory space.

Obviously, if you're doing DB updates or file writing, then you have to be concerned with concurrency.

Thanks for Suggestion

ziakhatri
12-26-2009, 02:46 AM
Use $password for sloving this issue