Since these path problems are a major roadblock for newbees to install Typo3 but also a very time consuming nasty thing for experienced users, I have done some work for resolving these issues.
Here are some patched files which should handle paths correctly.
t3lib_div, basically changed the function getIndpEnv()
http://typo3.sunsite.dk/.patches/class.t3lib_div.php.txt
Some 'entry scripts' in which the declaration of the constant "PATH_thisScript" had to be fixed:
http://typo3.sunsite.dk/.patches/index.php.txt
http://typo3.sunsite.dk/.patches/showpic.php.txt
http://typo3.sunsite.dk/.patches/init.php.txt
http://typo3.sunsite.dk/.patches/thumbs.php.txt
So what is it I actually changed?
In the function getIndpEnv() I changed the code responsible for getting SCRIPT_NAME and SCRIPT_FILENAME.
In those parts of the code I have
- replaced all occurrences of any PATH_* or SCRIPT_* with for example:
( PATH_INFO ? PATH_INFO : ORIG_PATH_INFO)
So that if PATH_INFO is not set, the corresponding ORIG_* variable is used instead.
(in the above code $HTTP_SERVER_VARS[''] has been removed for easier readability)
- At some places in the code the php_sapi_name "cgi-fcgi" was not recognized at all.
My patch treats "cgi-fcgi" exactly like the normal "cgi"
- A fall back mechanism has been introduced, so if according to the value of php_sapi_name() PATH_TRANSLATED or its corresponding ORIG_* variable should be used but is not available, the code automatically tries to use SCRIPT_FILENAME.
Since the code is still in one line, it's a bit hard to read.