Take the 2-minute tour ×  I'm building a webapp. HTML+AJAX <-->
PHP <--> MySQL; very traditional. What I need to do is have some
state that all sessions can read from, and something that drives
state changes even when there are no users looking at the site.
A simple example would be a counter. We start the counter
running from zero, and then whenever any user connects to the
website, they see the current value of the counter. Even if
nobody is looking at the website, the counter still increases.
Everyone looking at the website sees the same value at the same
time.  What's the best way to implement this? It seems like I
should be able to do this without resorting to storing values in
the database and having everyone query the database for state.
But I don't know how to have PHP running when nobody is
connected. Do I need a fourth component? I don't have my own
webserver, this stuff is all hosted at some off the shelf place
that setup the environment for me, but they seem to have most
up-to-date and reasonable