I am creating a .php file that will be uploaded to the root directory of a server. I need that .php file so that the path to the public_html folder can be traced or its equivalent.
I need to do this because I should be able to upload my .php file in root to any hosting account because many hosting companies use different file paths to file public Or even make a few different calls, I'm trying to figure out how to find it.
To do this is the server server variable or simple test. If not, there will always be a special file in the public_html folder, so I can search this particular file and get the path like this. I'm just concerned about finding a file name which is getting heavy on memory
The .ppp file being executed is located inside the root directory and it needs to detect the public_HML folder
like this: / home / User / file.php
needs to be detected
/ home / user / Public_html / or / home / User / var / www / or /home/user/website.com/html/ etc
The challenge with this is that a lot of the server's public_html should be outside the context of a request So that you know what is not a real way.
One thing is that you may be able to get this information from a php script (if you access the URL on the host), a php file called docroot.php Which looks like this.
& lt ;? Php if ($ _SERVER ["REMOTE_ADDR"] == '127.0.0.1') {Echo $ _SERVER ["DOCUMENT_ROOT"]; } Then you will have to do something within your file.fp
$ docRoot = trim (file_get_contents ("http://www.mydomain.com /docroot.php ")); This makes the assumption that the server can solve the name itself through the local interface.
No comments:
Post a Comment