I'm using PHP as an Apache module, not CGI. Every request made to a particular virtual host should result in a PHP script's execution ('/srv/web/init.php'), and I do this like so:
<VirtualHost *:80>
ServerName example.com
DocumentRoot /srv/web/
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/init\.php$
RewriteRule .* /init.php [L]
</VirtualHost>
This virtual host serves no other purpose besides executing init.php and returning its output to Apache for the response. My question is whether there is a cleaner way to do this - ie. bypassing Apache's filesystem emulation so that a "public" folder isn't required and so mod_rewrite isn't necessary. Much like calling a CGI script, it would go like this:
<VirtualHost *:80>
ServerName example.com
PHPScript /srv/web/init.php
</VirtualHost>
I've removed the DocumentRoot directive above since what I'm proposing would render it useless. Am I just trying to turn the Apache module into CGI, and should I just use CGI?