I know the problem has probably been solved one way or another, but am just wondering why nobody mentioned a very simple way to have exactly the same files for mod_php and cgi_php (or I'm missing something).
Say your file1.php, file2.php, ..., are all in a /www/php/ directory which is not your cgi directory. In your cgi directory put the following files:
file1.php:
#!/usr/local/bin/php
<? chdir("/www/php");
include "file1.php";
?>
file2.php:
#!/usr/local/bin/php
<? chdir("/www/php");
include "file2.php";
?>
etc.
Then, http://www.your.domain/cgi-bin/file1.php means using cgi_php to display the same file as http://www.your.domain/php/file1.php using mod_php. Moreover, by means of suexec or cgiwrap you may even change the user under which the web server runs, nobody for mod_php and somebody else for cgi.
Cheers,
Jack