Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP asynchronous reading (shell scripting)

Tags:

shell

php

pipe

I have a PHP TCP daemon which provides data to clients. One of the features is to get info from "tail -f messages" command. So I have to run this command asynchronously and in case of new data, send it to the clients.

I have a problem how to create this asynchronous reader - when new data is added, run the method, otherwise do the other things you have to.

Mejmo

EDIT: My problem could be resolved by using some kinds of threads and IPC (does php support threads?).

like image 495
Mejmo Avatar asked Apr 14 '26 05:04

Mejmo


1 Answers

If you can install extensions, you can implement this using the libevent PHP extension.

like image 163
Evert Avatar answered Apr 16 '26 17:04

Evert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!