Core Documentation
Extension Key: doc_core_compserv
Copyright 2000-2003, Kasper Skårhøj, <kasper@typo3.com>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.com
Introduction
This matrix shows the results of a analysis of system variables from different server OS /win/unix) / server Types (Apache / ISS) and PHP modes (CGI / Module).
Matrix
Test: | WA13CGI | WA2CGI | WA13ISAPI | WA2ISAPI | WISS_CGI | WISS_ISAPI | MA13MOD | LA13CGI | LA2CGI | LA2MOD | LA13MOD |
|---|---|---|---|---|---|---|---|---|---|---|---|
REQUEST_URI | OK | OK | OK | Empty | Empty | OK | OK | OK | OK | [path]?[query] Eg. “/typo3/32/temp/phpcheck/index.php/arg1/arg2/arg3/?arg1,arg2,arg3&p1=parameter1&p2[key]=value” | |
REMOTE_ADDR | OK | OK | OK | OK | OK | OK | OK | OK | OK | Eg. “192.168.1.180” | |
REMOTE_HOST | OK | OK | OK | OK | OK | OK | OK | OK | OK | Eg. “my_computer” or the IP address or blank. Depends. Well, this value is only used informational, so it doesn't matter too much. | |
PATH_INFO, regular | [path_script] | [path_script] | OK | [path_script] | OK | (OK - coundn't see) | [path_script] | [path_script] | OK | [Empty], Test: “index.php?p1=parameter1” | |
PATH_INFO, active | N/A | N/A | OK | N/A | N/A | OK | N/A | N/A | N/A (!! ikke-cgi!) | [path_info], Eg. “/arg1/arg2/” Test: “index.php/arg1/arg2/?p1=parameter1” | |
SCRIPT_NAME | /php/php.exe | /php/php.exe | OK | OK (=PATH_INFO) | OK | OK | /cgi-bin/php JW: OK!!! (strange) | /php-bin/php | OK | [path_script], Eg. “/phpcheck/index.php” | |
SCRIPT_FILENAME | c:/php/php.exe | C:/wampp2c/php/php.exe | OK | Empty | Empty | OK | /home/doms/knoell.org/cgi/php | /usr/php-4.2.3/php | OK | Abs. path to file on server (also if symlinked), Eg. “/www/htdocs/index.php” or “c:/www/htdocs/index.php” | |
HTTP_HOST | OK | OK | OK | OK | OK | OK | OK | OK | OK | [host][:[port]], Eg. “192.168.1.4:8080” [Std. Hostname/IP number] | |
HTTP_USER_AGENT | OK | OK | OK | OK | OK | OK | OK | OK | OK | [Std. User agent] | |
HTTP_ACCEPT_ENC. | OK | OK | OK | OK | OK | OK | OK | OK | OK | [Std. Encoding] | |
HTTP_REFERER | OK | OK | OK | OK | OK | OK | OK | OK | OK | [scheme]://[host][:[port]][path] | |
QUERY_STRING | OK | OK | OK | OK | OK | OK | OK | OK | OK | [query] | |
DOCUMENT_ROOT | OK | OK | OK | Empty | Exists | OK | Exists | OK | OK | Document root of site as configured in apache, eg. “/www/htdocs/typo3/32/cgi_directory” or “c:/www/htdocs/” DOCUMENT_ROOT depends very much on stuff like virtual directories, aliases etc. so we should not use it and depend on it. Rather use TYPO3_DOCUMENT_ROOT which is calculated based on SCRIPT_FILENAME and SCRIPT_NAME | |
PATH_TRANSLATED | Abs path to file (like SCRIPT_FILENAME for LA13MOD). With double-backslash. | Abs path to file (like SCRIPT_FILENAME for LA13MOD). With double-backslash. Eg. “C:\\htdocs\\php_cgi\\phpcheck\\index.php” | OK | See WA2CGI | See WA2CGI | OK | Abs path to file? “/home/doms/knoell.org/subs/kasper/index.php” | Abs path to file? | Empty | [Empty / nonsense with PATH_INFO] | |
REDIRECT_URL | OK | OK | Empty! | Empty | Empty | Empty | OK | OK | Empty | equals REQUEST_URI but without QUERY_STRING [path_script] Not used anyways. | |
Cookie | OK | OK | OK | OK | OK | OK | OK | OK | OK | OK | |
PATH_thisScript | OK | OK | OK | OK | OK | OK | ? /home/doms/knoell.org/subs/kasper/index.php | OK | OK | Points to absolute script path with forward unix style single slash. On windows, with “x:/” as start of path. Eg: “/www/htdocs/index.php” or “c:/www/htdocs/index.php” | |
php_sapi_name() | cgi | cgi | apache | cgi | isapi | apache | cgi | cgi | apache2filter | “apache” | |
TYPO3_OS/PHP_OS | WIN/WINNT | WIN/WINNT | WIN/WINNT | WIN/WINNT | WIN/WINNT | /Darwin | /Linux | /Linux | /Linux | /Linux | |
TESTERS | SELF | SELF | SELF, MS, JR | SELF (ISS+PWS), MS | SELF (PWS on WinNT4) | Axel Jindra <mail@jindra.de> | SELF, Peter Knoell <pknoell@gmx.de>, Jochen Weiland | SELF | SELF | SELF, JR | |
Action to take: | “CGI-syndrome” | “CGI-syndrome” REQUEST_URI must be constructed from HTTP_HOST, SCRIPT_NAME/PATH_INFO and QUERY_STRING. | ENV-vars (+getenv()) is totally empty. Only server-vars are available. REQUEST_URI must be constructed from HTTP_HOST, SCRIPT_NAME/PATH_INFO and QUERY_STRING. | “CGI-syndrome” | “CGI-syndrome” | ENV-vars (+getenv()) is totally empty. Only server-vars are available. | |||||
COMPENSATED | OK | OK | OK | OK | OK | OK | OK (Memory limit of more than 8 MB was needed, otherwise there were blank screens. Seen in EM, InstallTool, Photomarathon, TipAFriend etc) | OK |
Notes:
“WISS” - Windows IIS - may also be tested as “Windows PWS” (Personal Web Server). They are expected to yield similar behaviour. If this is not true, please let me know (kasper@typo3.com).
https:// - port 443, was seen in URLS.
“CGI-syndrome” above means:
1) PATH_TRANSLATED seems to be SCRIPT_FILENAME. On windows the path is with double-backslashes also!
2) PATH_INFO seems to be SCRIPT_NAME
3) PATH_INFO contains a value on normal requests (SCRIPT_NAME) and seems to NOT work with the “/arg1/arg2” trick
“PATH_INFO” is not empty for any CGI versions and the “PATH_INFO-trick” does not work for any of those either. So PATH_INFO should probably be forced to zero for all CGI-servers.
Fra t3lib_div:
/*
Conventions:
output from parse_url():
URL:http://username:password@192.168.1.4:8080/typo3/32/temp/phpcheck/index.php/arg1/arg2/arg3/?arg1,arg2,arg3&p1=parameter1&p2[key]=value#link1
[scheme] => 'http'
[user] => 'username'
[pass] => 'password'
[host] => '192.168.1.4'
[port] => '8080'
[path] => '/typo3/32/temp/phpcheck/index.php/arg1/arg2/arg3/'
[query] => 'arg1,arg2,arg3&p1=parameter1&p2[key]=value'
[fragment] => 'link1'
Further definition: [path_script] = '/typo3/32/temp/phpcheck/index.php'
[path_dir] = '/typo3/32/temp/phpcheck/'
[path_info] = '/arg1/arg2/arg3/'
[path] = [path_script/path_dir][path_info]
Keys supported:
URI______:
REQUEST_URI=[path]?[query]= /typo3/32/temp/phpcheck/index.php/arg1/arg2/arg3/?arg1,arg2,arg3&p1=parameter1&p2[key]=value
HTTP_HOST=[host][:[port]]= 192.168.1.4:8080
SCRIPT_NAME=[path_script]++= /typo3/32/temp/phpcheck/index.php// NOTICE THAT SCRIPT_NAME will return the php-script name ALSO. [path_script] may not do that (eg. "/somedir/" may result in SCRIPT_NAME "/somedir/index.php")!
PATH_INFO=[path_info]= /arg1/arg2/arg3/
QUERY_STRING=[query]= arg1,arg2,arg3&p1=parameter1&p2[key]=value
HTTP_REFERER=[scheme]://[host][:[port]][path]= http://192.168.1.4:8080/typo3/32/temp/phpcheck/index.php/arg1/arg2/arg3/?arg1,arg2,arg3&p1=parameter1&p2[key]=value
(Notice: NO username/password + NO fragment)
CLIENT____:
REMOTE_ADDR=(client IP)
REMOTE_HOST=(client host)
HTTP_USER_AGENT=(client user agent)
HTTP_ACCEPT_LANGUAGE= (client accept language)
SERVER____:
SCRIPT_FILENAME=Absolute filename of script(Differs between windows/unix). On windows "C:\\blabla\\blabl\\" will be converted to "C:/blabla/blabl/"
DOCUMENT_ROOT=Absolute path of root of documents:DOCUMENT_ROOT.SCRIPT_NAME = SCRIPT_FILENAME
Special extras:
TYPO3_HOST_ONLY=[host]= 192.168.1.4
TYPO3_PORT=[port]= 8080 (blank if 80, taken from host value)
TYPO3_REQUEST_URL =[scheme]://[host][:[port]][path]?[query](sheme will by default be "http" until we can detect if it's https -
TYPO3_REQUEST_SCRIPT = [scheme]://[host][:[port]][path_script]
TYPO3_REQUEST_DIR =[scheme]://[host][:[port]][path_dir]
TYPO3_SITE_URL = [scheme]://[host][:[port]][path_dir] of the Typo3 website
Notice: [fragment] is apparently NEVER available to the script!
Testing suggestions:
- Output all the values.
- In the script, make a link to the script it self, maybe add some parameters and click the link a few times so HTTP_REFERER is seen
- ALSO TRY the script from the ROOT of a site (like "http://www.mytest.com/" and not "http://www.mytest.com/test/" !!)
*/