I've a php application available in this path:
A:\Utenti\John\Programmi\Bitnami\Wampstack\apache2\htdocs\Log
I want take this full directory path, I actually tried with this:
$logPath = $_SERVER['DOCUMENT_ROOT'] . rtrim($this->_logPath, DIRECTORY_SEPARATOR);
var_dump($logPath);
but I get:
A:/Utenti/John/Programmi/Bitnami/Wampstack/apache2/htdocs/home/app_test/cfg
and should be:
A:/Utenti/John/Programmi/Bitnami/Wampstack/apache2/htdocs/Log/home/app_text/cfg
MORE DETAILS:
- What's
$this->_logPath
?
is a class variable that contains the following: home/app_text/cfg
, how you can see it's join to the $_SERVER['DOCUMENT_ROOT']
;
- Which WebServer I use?
I'm actually on Bitnami in localhost, but this system will work in any online web server.
Anyway, I almost fix the problem using this:
$logPath = __DIR__ . rtrim($this->_logPath, DIRECTORY_SEPARATOR);
that return:
A:\Utenti\John\Programmi\Bitnami\Wampstack\apache2\htdocs\Log\Log/home/app_test/cfg
how you can see the Log
folder is duplicated, but I don't think that using __DIR__
should fix the problem, maybe you guys have a more elegant solution?