So basically, I write the framework, and as part of its functions, it should provide the end developer with a set of well-established URIs / paths.
Some of these paths use $_SERVER['DOCUMENT_ROOT'] :
CFG::set('ABS_WWW', str_replace( $tmpseps, DIRECTORY_SEPARATOR, truepath($_SERVER['DOCUMENT_ROOT']).'/' ) ); CFG::set('REL_K2F', str_replace( array('//','\\'), '/', str_replace(CFG::get('ABS_WWW'),'/',CFG::get('ABS_K2F')) ) );
The code has been configured to work with both Linux and Windows. It seems to work most of the time on Linux, quite seamlessly on VPS.
However, recently I tried it on the HG Reseller Account (shared hosting), and it all fell apart. I printed the data inside $ _SERVER on the problem machine:
Array ( ** [DOCUMENT_ROOT] => /usr/local/apache/htdocs [GATEWAY_INTERFACE] => CGI/1.1 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9;q=0.8 [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7 [HTTP_ACCEPT_ENCODING] => gzip,deflate [HTTP_ACCEPT_LANGUAGE] => en-gb,en;q=0.5 [HTTP_CONNECTION] => keep-alive [HTTP_COOKIE] => <snip> [HTTP_HOST] => <snip> [HTTP_KEEP_ALIVE] => 115 [HTTP_USER_AGENT] => <snip> [PATH] => /bin:/usr/bin [QUERY_STRING] => [REDIRECT_STATUS] => 200 [REMOTE_ADDR] => <snip> [REMOTE_PORT] => 49262 [REQUEST_METHOD] => GET [REQUEST_URI] => /~sitename/ ** [SCRIPT_FILENAME] => /home/sitename/public_html/index.php [SCRIPT_NAME] => /~sitename/index.php [SERVER_ADDR] => <snip> [SERVER_ADMIN] => <snip> [SERVER_NAME] => <snip> [SERVER_PORT] => 80 [SERVER_PROTOCOL] => HTTP/1.1 [SERVER_SIGNATURE] => Apache mod_fcgid/2.3.5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at <snip> Port 80 [SERVER_SOFTWARE] => Apache mod_fcgid/2.3.5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 [UNIQUE_ID] => TVox-Eo1Z8IAAG1kAh4AAAEZ [PHP_SELF] => /~sitename/index.php [REQUEST_TIME] => 1297756668 [argv] => Array ( ) [argc] => 0 )
And my car:
Array ( [HTTP_AUTHORIZATION] => [HTTP_HOST] => <snip> [HTTP_USER_AGENT] => <snip> [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9;q=0.8 [HTTP_ACCEPT_LANGUAGE] => en-gb,en;q=0.5 [HTTP_ACCEPT_ENCODING] => gzip,deflate [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7 [HTTP_KEEP_ALIVE] => 115 [HTTP_CONNECTION] => keep-alive [PATH] => <snip> [SystemRoot] => C:\Windows [COMSPEC] => C:\Windows\system32\cmd.exe [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC [WINDIR] => C:\Windows [SERVER_SIGNATURE] => [SERVER_SOFTWARE] => Apache/2.2.11 (Win32) PHP/5.3.1 [SERVER_NAME] => <snip> [SERVER_ADDR] => <snip> [SERVER_PORT] => 80 [REMOTE_ADDR] => <snip> ** [DOCUMENT_ROOT] => C:/wamp/www/ [SERVER_ADMIN] => admin@localhost ** [SCRIPT_FILENAME] => C:/wamp/www/K2F/cms/cms-joomla-1.5/index.php [REMOTE_PORT] => 49947 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /K2F/cms/cms-joomla-1.5/ [SCRIPT_NAME] => /K2F/cms/cms-joomla-1.5/index.php [PHP_SELF] => /K2F/cms/cms-joomla-1.5/index.php [REQUEST_TIME] => 1297758541 )
** The parts you should read should explain my problem well.
So, while waiting for DOCUMENT_ROOT there is /home/sitename/public_html/ , but instead I got /usr/local/apache/htdocs .
Oh and sorry if I was too verbose;)
Edit:
getcwd() => /home/visitgoz/public_html
__FILE__ => /home/visitgoz/public_html/K2F/config.php