|
PHP itself is capable of running interactive; its the http protocol that is stateless.
To do what you want to do, and not clog up the httpd, than you would want to write a socket handler and execute it on an infinite loop in the background. So launch that on the command line. It then needs to store any information and pick any information up through a file or db. You can pipe directly to the running process, but frankly simply writing a queue of commands into a filesystem file is a lot easier to do in PHP than piping into a running process.
This is why I have suggested the use of Java RMI since they establish persistent connections.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
|