[BNM] PHP. Any recommendations for running a php process asynchronously?

AndrewGill73@gmail.com andrewgill73 at gmail.com
Mon Mar 16 14:09:45 GMT 2009


Thanks David and Leo.  I don't have any programming experience in a
multi-threaded language unfortunately.

Yes, I will re-engineer the process as David suggested. I will then
execute the php script from shell (probably using wget).

I need the xmpp process to be scalable so will execute the script
(using wget) on different hosts to get some scalability (if required).

Any other ideas / input very welcome!

cheers,
Andy

2009/3/16 Leo Brown <lists at acumendevelopment.net>:
> Hi
>
> Yes, PHP doesn't support native multithreading unless custom compiled to use
> Apache's multithreading architecture, and even then it's dodgy, so your
> approach to use the shell is simplest as the shell (and for instance wget)
> can be multithreaded.
>
> Or you could review what's causing the 2 second delay, would be happy to
> look at the source- presuming it's network comms rather than processing
> power of course (as otherwise multithreading obviously wont help!)
>
> In terms of OS dependency on the shell, a really simple approach is just to
> detect OS and run slightly different code, after all you're only talking
> about a few lines.
>
> Good luck!
>
> Leo
>
> -----Original Message-----
> From: bnmlist-bounces at brightonnewmedia.org
> [mailto:bnmlist-bounces at brightonnewmedia.org] On Behalf Of
> AndrewGill73 at gmail.com
> Sent: 16 March 2009 12:11
> To: Brighton New Media
> Subject: [BNM] PHP. Any recommendations for running a php process
> asynchronously?
>
> Hello BNM,
> I'm running a php script that sends google chat (xmpp) messages to
> approx 20 users. It works well but the script takes approx 2 seconds
> to run for each user so takes 40 seconds to run in total (too slow).
>
> So I'm thinking about running this php process asynchronously - it
> needs to run reliably on fairly standard windows or unix shared hosted
> environments.
>
> I was wondering if anyone knows the best way of doing this?
>
> Below are a few approaches I'm thinking about:
>
> popen()
> proc_open()
> exec() - then run wget.
>
> Are there any better approaches?? Any ideas or experiences most
> gratefully received!
>
> cheers,
> Andy Gill
> --
>
> BNM Subscribe/Unsubscribe:
> http://www.brightonnewmedia.org/options/bnmlist
>
> BNM powered by Wessex Networks:
> http://www.wessexnetworks.com
>
> --
>
> BNM Subscribe/Unsubscribe:
> http://www.brightonnewmedia.org/options/bnmlist
>
> BNM powered by Wessex Networks:
> http://www.wessexnetworks.com
>


More information about the BNMlist mailing list. Powered by Wessex Networks