So I want to make a daemon.php file which can open a port on a give ip address and request data from client.php and with the browser to listen/read to earlier pipe (Would that be a problem for the security or not?).
I fount this funphp tutorial which seems to be good but is more like a cronjob, I found also function stream-socket-server but can handle only one request and then shuts down, and I really don't know where exactly to put listener.
-
That's not the way php is supposed to be working. PHP is really about request/response. There is no natural support for scripts running longer than a single request.pintxo– pintxo2015-03-13 08:45:52 +00:00Commented Mar 13, 2015 at 8:45
-
@pintxo No, there is a way, the PHP Built--In Server : it is created especially to help developers and for testing purposes only...Halayem Anis– Halayem Anis2015-03-13 08:57:22 +00:00Commented Mar 13, 2015 at 8:57
-
but are so many function there like flush for example who is able to respond to server and also to maintain the connection openRobert-Dan– Robert-Dan2015-03-13 08:58:41 +00:00Commented Mar 13, 2015 at 8:58
Add a comment
|
1 Answer
You can use the PHP Built-In Server
php -S localhost:8000 OR php -S localhost:8000 rt.php Now, just open your browser and type; localhost:8000
3 Comments
Halayem Anis
@JohniDevo, sorry i don't understand your question
Robert-Dan
The
-S from the php -S localhost:8000 rt.php is also a scipt and contains what i write earlier in my questionHalayem Anis
The
-S it is an option that means 'START' i think, in your case you have to do like this : php -S localhost:8000 daemon.php