PDA

View Full Version : SetEnv equivalent for LiteSpeed?


Mango
06-09-2008, 01:24 PM
Hiya :)

Is there a SetEnv equivalent for LiteSpeed? I'd like to specify a variable in my root .htaccess and have it accessible by any script. If someone could point me in the right direction for this, that would be great.

On the LiteSpeed forums it was suggested to someone that they "create a dedicated lsphp external application for that vhost, then add environment there." I wouldn't even know where to start!

I suppose I could just use an auto_prepend_file and have the PHP script set the variable there. That wouldn't cause unnecessary overhead, would it?

-Mango :D

Kevin
06-09-2008, 06:17 PM
We can't really support creating separate lsphp configurations for different customers due to the number of virtualhosts on these systems. I would imagine a solution that uses PHP directly should be fine until LiteSpeed gets around to implementing SetEnv in their Apache configuration directive handler.

magnify
06-10-2008, 01:17 PM
You can use mod_rewrite to set environment variables.

RewriteRule ^(.*) /path/to/file/$1 [E=VAR:VAL]

RewriteRule ^(.*) /hsphere/local/home/USERNAME/DOMAIN/$1 [E=Name:Magnify]

Something similar to that, you'd make it match every file, and return that file.

If your using steadfast's shared hosting, then you'd replace username, and domain to your username, and domain name.

[E=Name:Magnify]
Would set the 'Name' variable to 'Magnify'

You'll probally have to play around with, and read up on mod_rewrite to get it to work correctly, also this approach adds more overhead than using SetEnv.

The Universes
06-11-2008, 02:26 AM
Any reason you can't simply store the variable in a php file and include it whenever its needed?