At times, applications may require the creation of an internal server environment variable, such as you might set up with the SetEnv directive in Apache. You can set up server environment variables in OpenLiteSpeed, too.
Server Side Setup
Log in to the WebAdmin Console, navigate to Virtual Host > External App. For this example, let’s use PHP.
In the Environment field, add the variables
TEST_VALUE2, like so:
Save and restart OpenLiteSpeed.
Please note: if you are using PHP detached mode, you must first kill the
lsphp process so it may be restarted. Otherwise the new variables won’t be loaded.
You can access the new variables in PHP code such as the following
<?php $test1 = $_SERVER['TEST_VALUE']; $test2 = getenv('TEST_VALUE2'); echo $test1.' '.$test2;
Access test.php from the browser, and you should see the values that were set at the server level, like so: