I have created a simple script which outputs the results of all three document "root" results.
http://andreca.tk/dirtest/
As you can see, Document root 2 and 3 outputs the same thing, unlike document root 1.
So why was it said to try using __DIR__ if it isn't replicating the same result as the "original"?
Maybe using a superglobal variable (forgot the type) and string replacing the result can help end up with just the document root?
I'm currently trying to fix my script regarding errors just appearing which I have now solved, the only remaining issue is that require_once() doesn't work with either of the things used on that test script which I have linked too above.
The error exactly?:
Same error for every "alternative".
I have noticed duplicate directories in these errors.
If the output from Document Root 1 outputs the thing that we are wanting then could there be more to it, but I have no idea what it could be.
It would be awesome if someone could point out what they think or what is going on here.
Workaround: Still use $_SERVER['DOCUMENT_ROOT'] but string replace the duplicating directories shown in the error.
This is an example of part of my code (which I have altered even more after coding this):
http://andreca.tk/dirtest/
As you can see, Document root 2 and 3 outputs the same thing, unlike document root 1.
So why was it said to try using __DIR__ if it isn't replicating the same result as the "original"?
Maybe using a superglobal variable (forgot the type) and string replacing the result can help end up with just the document root?
I'm currently trying to fix my script regarding errors just appearing which I have now solved, the only remaining issue is that require_once() doesn't work with either of the things used on that test script which I have linked too above.
The error exactly?:
Code:
[22-Oct-2014 12:52:27 America/New_York] PHP Fatal error: require_once(): Failed opening required '/home/pscoolap/public_html/sesslogin/main/sesslogin/config.php' (include_path='.:/opt/alt/php54/usr/share/pear:/opt/alt/php54/usr/share/php') in /home/pscoolap/public_html/sesslogin/main/index.php on line 2
I have noticed duplicate directories in these errors.
If the output from Document Root 1 outputs the thing that we are wanting then could there be more to it, but I have no idea what it could be.
It would be awesome if someone could point out what they think or what is going on here.
Workaround: Still use $_SERVER['DOCUMENT_ROOT'] but string replace the duplicating directories shown in the error.
This is an example of part of my code (which I have altered even more after coding this):
PHP:
str_replace('/sesslogin/sesslogin','/sesslogin',$_SERVER['DOCUMENT_ROOT'])
Last edited: