News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

WorkingSoftware.com.au:
Something Like Threading- PHP Process Forking & Interprocess Communication
June 07, 2007 @ 10:21:00

New from Iain Dooley on the Working Software website today is his look at working with threading in PHP including forking and communication between the processes.

I recently wrote a little application that dumps a file across a forwarded port. [...] So when I first wrote it, I didn't know what I was doing and had never written socket code before, so it was a big procedural mess. Naturally I was keen to separate out my socket class into it's own package but this presented a problem: the controlling process needed to check the status but how could I decouple the process that instantiated the socket class from the socket code itselfī›¸

So, he set about working up his class, hitting a few barriers along the way:

  • Copy On Write issues with how PHP handles the variable for the forked process
  • Interprocess Communication using Sockets using the socket_create_pair function
  • a "Curious Interlude" about why you can share sockets between two processes

There's a example of it in action - a setup with a child process that's all set to count up and respond back with the current number to the managing script.

0 comments voice your opinion now!
fork process communication thread tutorial fork process communication thread tutorial


blog comments powered by Disqus

Similar Posts

Matthew Weir O'Phinney's Blog: Login and Authentication with Zend Framework

Vanessa Vasile's Blog: Simple Way to Parse an x509 Certificate with PHP

NETTUTS.com: CodeIgniter From Scratch: Day 4 – Newsletter Signup

PHP and Me Blog: Use Phing to Update your SVN-Version-Controlled Website Automatically, Through FTP

IBM developerWorks: Locking down your PHP applications


Community Events

Don't see your event here?
Let us know!


security opinion framework api extension language interview series laravel version symfony unittest threedevsandamaybe release podcast laravel5 voicesoftheelephpant community introduction library

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework