I've got a version of the A* algorithm that builds a graph of the UK road and cycle network in Python lists. It takes about 30 seconds to initialise, but once done can very quickly find the shortest route between any two vertices. The start and finish vertex ids are provided by PHP.
I'm trying to work out the best way of communicating between PHP and the Python program. I only want to do the initialisation phase when the Apache server starts, so my question is: How do I keep the python program alive and request routes from it via php? I have a GLAMP setup.