Request for select(2) and/or poll(2) equivalents to be in PHP4

From: Date: Sat, 20 Nov 1999 16:08:02 +0000
Subject: Request for select(2) and/or poll(2) equivalents to be in PHP4
Groups: php.version4 
Request: Send a blank email to php-version4+get-6587@lists.php.net to get a copy of this message
Hi there. I exchanged some emails with andy@zend.com. He told me to get there, so do I. My problem is the lack of select(2) or poll(2) ala Unix/Linux in PHP. Sure PHP scripts are designed to run for a very small time but at my company we are writing more & more PHP scripts and now face the following problem: - We have a PHP3 application running as a server on Apache. This application is a monitoring application: it gets connected to other applications thru fsockopen and gets data with fgets. Now if we need to monitor more than one target, we have more than one fd opened. If we put these fd non blocking (the only possible way in this case), the CPU time is wasted to perform a endless loop between all the fd because we have no select or poll instruction. We can write an external server in C (or Perl or whatever language that offer 'select') that would provide a single socket to the PHP server code, and have this external server manage all the sockets connected to the targets to monitor. However it is not very elegant (and error prone) to have to insert such an external server when everything could be done in a single portable language, PHP, if only something like select(2) would be available. Readline() could also be rewritten to have a real timeout system and not a 'while' consumming CPU time. Hence my request for such a feature... (Being new here, I hope I won't start or restart some kind of religious war ;-) ) -- Bernard Fouché CPIO MULTIMEDIA S.A

« previous php.version4 (#6587) next »