Re: triggering scripts through apache configuration
| From: | Marek Kilimajer | Date: | Sat, 19 Jun 2004 11:45:23 +0000 |
| Subject: | Re: triggering scripts through apache configuration | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-188636@lists.php.net to get a copy of this message | ||
Chris Wagner wrote --- napísal::
hello, wondering how you might go about triggering PHP scripts from an apache configuration file, for certain events... for instance, how might i trigger a script whenever a file was accessed within a given directory. and, would it be possible to know which file was accessed? if the above is possible, could you also trigger different scripts for when a "file download begins" and when a "file download finishes"? thanks.Seems you want mod_rewrite. Lets say you have /download/ directory, then you put this in /download/.htaccess RewriteEngine on
RewriteRule ^.*$ handler.phphandler.php will be the script that will be triggered for all requests to /download/ directory, you can find out the real request from $_SERVER['REQUEST_URI'], do whatever magic you need to do. But don't forget that you will have to output the file yourself, in handler.php, including the right headers.