How to run by months: socket PHP from terminal and reply with commands to clients using browser?

hello,
I need run “eternally” script.php on port xxxx, when clientX send QUERY “color4today” I need send some codes…

but I need run (listen) script.php from SHELL

then some CLIENTS connect to IP:PORT with requests…

how we can do this into CyberPanel using minimal RAM ?

one more time:

sctipt.php running from SHELL, CLIENTS connect from browser

we know exists WEBSOCKETS but this not run fine running into CyberPanel from SHELL