I can use absolute paths in the include, but my host admin reported that causing the server to be overloaded with apache connections. (why it would be overloaded, I’m not sure, but figured I would try to find a better way to do this)
I want the files to be preprocessed because they include some wordpress php that can’t be easily processed outside the wordpress environment.
If the output of those two scripts doesn’t change all that often, you could just save the output to a file. Then you can just read it from the filesystem.
<?php readfile('header.html'); ?>
Some content/code goes
<?php readfile('footer.html'); ?>
The update script could be triggered manually by you as needed, or maybe run as a cron job, or integrated into the system that causes the output to change.
You can do it like this:
In header.php, at the top, check if a file header.cache exists, if it does, load it and echo it’s contents.
If not, do an ob_start, do your magic to print out the header, and then a ob_get_contents to get the output in a variable. Write that to disk to header.cache, and echo it.
Look at the PHP manual for ob_start.
I usually cache the stuff in APC or MemCached, but disks can work to, depending on your code.