Most web-based chat rooms are done with websockets, which PHP has support for.
The general websocket workflow in any supporting language would be roughly:
have a list of people who are connected to the 'room' and the associated websocket connection object for each user kept in memory. When a user sends their own message through the websocket, the server receives that message and a reference to the room it is for. The room id is used to find all users who are connected. The message is then sent back down the stored websocket connections to those users.
The messages are never necessarily stored in any database (redis, sql, nosql or anything else) and are only available to the users who are, at the time the message is sent, currently connected.
Sending the messages again to a user who connects later may be possible but would require a lot of extra work
That being said, PHP is probably not an ideal language for it in most setups because each request is far more separate from the previous then other languages, meaning websocket connections can't be stored and reused between requests. But you can do it with lambda functions and API gateway on AWS, if you feel like diving into the cloud. Otherwise, you may wish to look at other languages.