Background: I have got a bit of code that inspections to ascertain if a person includes a valid session before processing the php page that I must set because the auto_prepend_file. However, I have to exclude the page in which the user tries to login from needing a legitimate session. I must have the ability to set the car_prepend_file value with an per directory basis.

Atmosphere: PHP 5.2.6m Apache 2, running php like a cgi less mod_php, on Home windows (in the event that matters) as well as on a piece of equipment which i have total treatments for (not really a located atmosphere)

Utilizing a htaccess file has gone out b/c I'm not using mod_php. I haven't had the opportunity to change the in php.ini to create the carprepend_file, the server throws an interior error. And ini_set() doesn't work b/c it's already loaded the session checking file before I'm able to change the need for auto_prepend_file.

I don't see a method to set auto_prepend_file on the per directory basis if you're not using mod_php/htaccess. Shall We Be Held missing something?

You mention you cannot use .htaccess files but could you are making modifications to httpd.conf and make a move such as this:

<Directory "c:/wamp/www/dev/">
    Php_value auto_prepend_file c:/wamp/www/dev/prepend.php

EDIT - just realized this does not work when running as CGI. I believe though that certain factor which will jobs are should you produce a copy of the php.ini file, put it within the directory, and set your prepend directive inside like:

auto_prepend_file = c:/wamp/www/dev/prepend.php

There's an excellent tutorial known as: Automatically Include Files with PHP & Apache that let you know that to achieve that using the apache directive and PHP code to append in the finish. First, define personal files to trap the page of all time outputted and append anything you want:

  $script = <<<GA
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxxxxx-y']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  $replace = array('</body>','</BODY>');
  $page = str_replace($replace, "{$script}\r</body>", $page);
//   $replace2 = array('</title>','</TITLE>');
//   $page = str_replace($replace2, " - My Awesome Site</title>", $page);
  return $page;

Adding the Apache directive for your virtual host. You have to prepend the PHP file to be able to make use of the ob_start() method :

<Directory "/path/to/folder">
    AddType application/x-httpd-php .html .htm
    php_value auto_prepend_file /absolute/path/to/apache-prepend.php