Global Script
I have a customer who has multiple servers, but they can never remember which site a particular website is on. I would like to have them be able to go to whateverdomain.com/whereami and have it run a php script which displays the server name and IP address.
I have the php script to do that. From an Apache setup, what is the best way to accomplish this? Should I just add something like this to pre_main_global.conf?
ScriptAlias /whereami /var/www/html/whereami.php
FWIW, I tried this and for some reason it doesn't work. The permissions are 755 the php script. Does this belong in another folder?
Thanks for any advice.
-
I think you should add that in Pre VirtualHost Include 0 -
I was testing this a bit and it worked, although I used a .shtml file In pre_virtualhost_global.conf I put: ScriptAlias /whereami /var/www/html/netfinn/whereami.shtml (whereami.shtml was just printing something) EDIT: I made a php script to output hostname & IP address and it works. ScriptAlias /whereami /var/www/html/netfinn/whereami.php 0 -
Interesting - I really didn't think that would work based on the Apache docs, but I'm glad you found a solution! 0 -
I was testing this a bit and it worked, although I used a .shtml file In pre_virtualhost_global.conf I put: ScriptAlias /whereami /var/www/html/netfinn/whereami.shtml (whereami.shtml was just printing something) EDIT: I made a php script to output hostname & IP address and it works. ScriptAlias /whereami /var/www/html/netfinn/whereami.php
That is great that you got it working. I tried putting it in pre_virtualhost_global.conf but I am getting an error still. lscgid: execve():/var/www/html/whereami.php: Exec format error Perhaps this is because I am using Litespeed instead of Apache? Thanks!0
Please sign in to leave a comment.
Comments
5 comments