httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicholas Sherlock <n.sherl...@gmail.com>
Subject [users@httpd] Re: PHP script as Apache filter or "callback"
Date Sun, 15 Mar 2009 00:36:44 GMT
Brian Mearns wrote:
> I've got a PHP script that I want to call for every request under a
> certain location. Specifically, I want to alter/set the response
> headers using this script. I know headers can be set in other ways,
> but in this case, the heders are set using some fairly complex logic
> which I don't think can be done in the conf file directly, plus the
> PHP script will have some other side effects on the server.
> 
> Does anyone know of a way to do this? If not, can anyone point me to a
> good tutorial for writing apache filters?

You might try PHP's auto_prepend_file:

   auto_prepend_file  string

     Specifies the name of a file that is automatically parsed before 
the main file. The file is included as if it was called with the 
require() function, so include_path is used.

     The special value none disables auto-prepending.

This allows you to run some PHP code before any script in the directory 
you set it for is run. It will only work for documents which PHP is set 
to parse, of course, so it won't help out for requests for other objects 
like images.

Cheers,
Nicholas Sherlock


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message