Welcome to WebmasterWorld Guest from 54.167.83.224

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

How to define USR path?

     
7:40 am on Oct 20, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Oct 25, 2006
posts: 994
votes: 0


I have issue how to define real path on server.

Path is on FTP like sample: /secure/domains/myfiles

How to define correct real path not FTP if folders are at FTP /secure/domains/myfiles?
With usr which is REAL path is maybe:
/usr/secure/domains/myfiles/

Need help...

1:18 pm on Oct 20, 2009 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10542
votes: 8


not sure exactly what your question is...

that is the correct way to specify that path if /secure directory is in /usr, but there is not a "standard" directory such as "/usr" to place "ftp directories".

for example the root directory for one ftp login could be "/home/username/" and for another could be "/var/log/httpd/sitename/"

7:12 pm on Oct 20, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


Upload this script, run it on your server then DELETE it (do not leave it on your server:)

#!/usr/bin/perl
print "content-type: text/html\n\n";
foreach $v (sort keys %ENV) { print "$v $ENV{$v}<br>\n"; }

What you are looking for is the DOCUMENT_ROOT environment variable, this will reveal it, and should be the first one using sort.

Note that you may have a different path to perl,
#!/usr/bin/perl
#!/usr/local/bin/perl

Check with your host's documentation, they usually post this publicly.

8:28 am on Oct 21, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:May 31, 2008
posts:661
votes: 0


Note that you may have a different path to perl,
#!/usr/bin/perl
#!/usr/local/bin/perl

I think that's what he's after. It sounds to me like he is chrooted on ftp connections.

toplisek: when you're using ftp to connect to the server (I think that's what's happening to you), you're thrown into your home directory without a possibility to get out of there and access other system directories with ftp. when you run scripts, however, they are usually run without chroot (chroot = change root, root as in root directory, not root user), so /usr will be available and so will /usr/bin/perl or /usr/local/bin/perl or wherever perl may reside on your server.

5:08 pm on Oct 21, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


By the title it seems so, but

Path is on FTP like sample: /secure/domains/myfiles
How to define correct real path not FTP if folders are at FTP /secure/domains/myfiles?

Leads me to believe he/she is looking for the full server path. Meh, sorry for the guesswork.

6:45 pm on Oct 21, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Oct 25, 2006
posts:994
votes: 0


Exactly, I'm looking for FULL, ABSOLUTE path, not relative
Linux server,Apache
5:48 am on Oct 22, 2009 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10542
votes: 8


i would go with rocknbil's solution.
you won't always be able to see the full path in the ftp client.
using rocknbil's script if you are on virtual hosting you might have to look at another environment variable like SCRIPT_FILENAME to get the full path to your document root directory.
6:56 pm on Oct 22, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


But . . . that's what I'm saying, $ENV{'DOCUMENT_ROOT'} **is** the path to the domain's root, first in the list with that three-liner script. :-)
8:31 pm on Oct 22, 2009 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10542
votes: 8


not always - one of my tests was on a virtual host where i got the following results:
DOCUMENT_ROOT /var/www/htdocs
SCRIPT_FILENAME /var/www/htdocs/example.com/cgi-bin/env.cgi
SCRIPT_NAME /cgi-bin/env.cgi
SERVER_NAME example.com

"the real document root" for this site is /var/www/htdocs/example.com

12:32 am on Oct 23, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


Aye, and ye be correct, forgot all about virtual hosts. :-P
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members