Welcome to WebmasterWorld Guest from 54.196.233.239

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

How to define USR path?

     

toplisek

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

WebmasterWorld Senior Member 5+ Year Member



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...

phranque

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

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



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/"

rocknbil

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

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



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.

janharders

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

WebmasterWorld Senior Member 5+ Year Member



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.

rocknbil

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

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



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.

toplisek

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

WebmasterWorld Senior Member 5+ Year Member



Exactly, I'm looking for FULL, ABSOLUTE path, not relative
Linux server,Apache

phranque

5:48 am on Oct 22, 2009 (gmt 0)

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



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.

rocknbil

6:56 pm on Oct 22, 2009 (gmt 0)

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



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. :-)

phranque

8:31 pm on Oct 22, 2009 (gmt 0)

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



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

rocknbil

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

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



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

Featured Threads

Hot Threads This Week

Hot Threads This Month