|
Posted by Schroeder, AJ on 09/30/05 18:43
"Chris Hope" <blackhole@electrictoolbox.com> wrote in message
news:dhi3ss$v5h$1@lust.ihug.co.nz...
> Schroeder, AJ wrote:
>
>> I have googled this topic and I know this has been asked before, but
>> there seems to be no good answer except "PHP doesn't support
>> multi-threading" I am new to PHP so I might be using the wrong
>> terminology.
>
> That is correct. PHP has no support for multi threading.
>
Since it is a scripting language (albeit a higher level language than say
<shudder> VBScript) is there a chance that PHP would support
multi-threading? I don't even think that it could support it, but that is my
limited knowledge.
>> I have inherited support of php scripts that backup network gear via
>> SNMP. They currently work fine, and outside of the lack of good
>> overall program structure and flow, the scripts perform quite well.
>>
>> The script is back-ended by postgres, and when it executes, it grabs a
>> list of device names from the database, gets the count of devices,
>> then performs a while loop to back up every device - unelegant but
>> effective. However, the amount of network gear that is being backed up
>> is increasing, and I would like to "multithread" the script to backup
>> more than one device at a time so that it doesn't take 45 + minutes to
>> back up all of the switch gear.
>>
>> Is this possible with PHP? Personally I don't think so since PHP seems
>> to be a "top-down" language, but maybe the gurus in this group could
>> lend some insight. I have looked at the "tick" functions, but those
>> don't seem to be a good fit.
>>
>> Any help or ideas are appreciated,
>
> You can fork a process using the PHP CLI (assuming you're on a *nix box
> and it soundsl ike you probably are) like you can with most other
> scripting languages.
>
> Here's an article I wrote a while back which covers forking and has some
> basic examples:
> http://www.electrictoolbox.com/article/php/process-forking/
>
Yes, I am using a Redhat machine for the PHP scripting. Although I have not
read the entire article, it looks as if that might be what I am looking for.
I just have to find out if the admin before me installed PHP with forking
support. Something tells me he didn't. :(
Thank you for the advice,
AJ Schroeder
[Back to original message]
|