How to Use SetEnv on OpenLiteSpeed

#1
Hello, what I want to do is to add a special variable when the print_r($_SERVER) variable is pressed to the screen for existing and future websites.

Server configuration > External App > Edit > LiteSpeed SAPI App

I edited the field as in the image and added its value with my own variable.

Ekran Resmi 2024-01-08 13.27.11.png

I entered the commands service lscpd restart && service lsws restart and it didn't work and then i entered the pkill -9 lsphp commands and it still didn't work.
I use Cyberpanel, I tried to change and edit many files, but there is no change.
 

Cold-Egg

Administrator
#2
I tried the same settings, and the PHP env variable works in my test.

Added "X_DMC_USR=11111" to the environment.

Test script
Code:
<?php
foreach($_SERVER as $key => $value){
  echo "<b>$key:</b> $value<br>\n";
}
Browser displays
Code:
X_DMC_USR: 11111
PATH: /bin:/usr/bin
HTTP_ACCEPT:...
 
#3
I tried the same settings, and the PHP env variable works in my test.

Added "X_DMC_USR=11111" to the environment.

Test script
Code:
<?php
foreach($_SERVER as $key => $value){
  echo "<b>$key:</b> $value<br>\n";
}
Browser displays
Code:
X_DMC_USR: 11111
PATH: /bin:/usr/bin
HTTP_ACCEPT:...
Does it apply to all websites? Because in my tests, it works when I add them one by one as "Virtual Host", but it does not work on the "Server Configuration" page.
 
Top