http://bugs.winehq.org/show_bug.cgi?id=8924
--- Comment #21 from jvlad dmda@yandex.ru 2008-09-23 09:53:14 --- from the CGI perspectives, there are some crusial variables to have a CGI process started correctly, while the other variables are informative only. Feel free to comment out all variables with HTTP_ and SERVER_ in their names. I commented out HTTP_ and got php-cgi.exe to work under wine. Still, it does not really matter which particular variable you comment out. You can for example comment out HTTP_AGENT and re-introduce the same value under HTTP_GENTA name and get the same effect.
Php-cgi.exe relies on persistence of the values retuened by getenv. It first fetches some values, then changes the others and expect the first ones to remain the same and it works this way under Windows while under Wine the values are changed.
Check init_request_info() in sapi\cgi\cgi_main.c (see php source tree) In short, it first reads SCRIPT_FILENAME and PATH_TRANSLATED and keeps the pointers to the values returned by getenv(), then adds new variables, such as ORIG_PATH_INFO, then runs the script file. To do this it takes the file name from SCRIPT_FILENAME saved at the 1st step.