I changed the load order in my httpd.conf file which fixed the problem.
I did a little bit of debugging, and it looks like there are some issues in the TOC.js script when a container node does not have an associated URL (which is the case for my project). This code generates an exception, for example:
// Iterate nodes looking for the target
var targetNode = null;
for(i = 0; i < x.length; i++)
var id = x[i].getAttribute('Url'); <<-- id will be null if the node doesn't have an URL
id = id.substring(id.lastIndexOf("/") + 1, id.length - (id.length - id.lastIndexOf("."))); <<-- throws an exception because id is null
if(id == target)
targetNode = x[i];
I don't know enough (any) PHP to figure out why invoking TOC.js from the PHP script fails while the same script works well enough from index.html.
But my problem is solved for the time being.