Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to execute command via .htaccess

Status
Not open for further replies.

kdman

Programmer
Nov 20, 2006
2
YE
I need to run a php script every time some body open any page in my site.

I guess the best way to put a command in the .htaccess file.

the comman i need must to run a php script or page without the user had redirecting to any other page.

in shell i can use this command:php /home/user/public_html/script.php

but how in the .htaccess file?

if somebody know any other way to run a php script every time that'll b e great.

Thanks.
 
What is this script doing? Why don't you create php generated pages that include both this script and the content that you want to present?

Besides, I may be wrong, but I don't think that .htaccess is read for every page; only when entering the particular directory.
 
I can't include the script for each page and each time i had a new page.
this script must collect some info (stats) of explorer,OS .. etc

and the .htaccess got read every time somebody open the folder to brows a page (So if you have a locked folder you got the .htaccess message to enter the password for any requsted page in it).
 
Hi

Just theory, I would try it :
[ul]
[li]install [tt]mod_auth_any[/tt][/li]
[li]put a [tt].htaccess[/tt] file into the web root directory[/li]
[li]in the [tt].htaccess[/tt] set up authentication and in the [tt]AuthAnyUserProg[/tt] directive specify a script of yours[/li]
[li]hope that your script will receive all the environment as a CGI script receives[/li]
[li]in your script output the needed information to a file, then accept the request and let Apache serve it[/li]
[/ul]
Hmm... Very, very theoretically.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top