lsphp ENV vars

IrPr

Well-Known Member
#1
Hello,

Recently I added a php extension that gathers information from environment vars such as REMOTE_ADDR and HTTP_USER_AGENT but from $ENV not $SERVER vars

seems that lsphp doesn't handle such variables which is Apache style ENV vars
thus the extension is fully compatible with Apache but litespeed

please let me know how is it possible to add such variables in $ENV

Regards
 

IrPr

Well-Known Member
#2
please note that extension is suhosin and I am using upload verification script which I was able to configure script scan using cxs but it doesn't log request details such as IP and script path, etc

found that cxs uses ENV vars for such logs which seems litespeed doesn't pass them properly

please advice
 

mistwang

LiteSpeed Staff
#4
cxs run as an external process, it can only see real environment variable.
PHP's $ENV[] array is not real process environment, but a virtual one only known for PHP internal.

Only when PHP was running as CGI, all request info are passed as real process environment, so I suspect that cxs only works with CGI based PHP runtime, like suphp. even php-fpm will not work, but I never tried it.

We cannot change our API code to modify environment of a persistent PHP process for each request. A possible solution is to export some request variable as real environment variable based on _SERVER[] in suhosin code, after fork, before executing the cxs binary. You can send a feature request to suhosin.
 
Top