Reply to Re: Multithreading/Parallel Processing with PHP

Your name:

Reply:


Posted by Chris Hope on 09/30/05 04:20

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.

> 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/

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация