Re: php includes and ajax [message #173094 is a reply to message #173087] |
Mon, 21 March 2011 00:27 |
HaleLOIS
Messages: 10 Registered: December 2010
Karma:
|
Junior Member |
|
|
I think I saw in some past pasts that if I answer from Google groups the discussions don't stay under the same thread, so I've just signed up to compgroups (supposing that it's the home to comp.lang.php).
I just wanted to add that relative file paths aren't working for me on ajax requests, which is why I'm trying to get the absolute path.
The optimal solution would be being able to set the php ini include path, like so:
<?php
set_include_path($_SERVER['DOCUMENT_ROOT']."themes/glorioso/include/" . PATH_SEPARATOR . get_include_path() );
?>
But the $_SERVER["DOCUMENT_ROOT"] solution doesn't work on some hosted servers such as altervista.
The value of $_SERVER["DOCUMENT_ROOT"] on altervista is:
"/var/www/html"
but the absolute path to the website root is:
"/membri/"
This "/membri/" subdirectory can only be obtained by two $_SERVER variables, "ORIG_PATH_TRANSLATED" and "SCRIPT_FILENAME" that give something along these lines:
"/membri/consultapg33/themes/glorioso/ajax/newsadmin.php".
The value of $_SERVER["DOCUMENT_ROOT"] on aruba is:
"/web/htdocs/www.parrocchiasanlino.org/home/"
There is no "ORIG_PATH_TRANSLATED" variable, and "SCRIPT_FILENAME" gives:
"/web/htdocs/www.parrocchiasanlino.org/home/themes/glorioso/ajax/flopt.php",
so on aruba they coincide but on altervista they don't.
What's the best way to handle the absolute path taking all this into consideration?
|
|
|