Re: "/home/{user}/directory"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My question was, as usual, inadequately formed.

Realpath() was interesting but I was creating directories to store archived
data.  In my limited testing, it seemed that realpath returns a relative
path.  Other words, if you're already in home and you try
(realpath("~")."\archive\") then you get only "\archive\".

In test situations, I wanted to allow for the user to not be me.  It ended
up that I used GETCWD() so that it will run from anywhere that it can find
the required includes.

Nevertheless, the answers given enabled me to find a solution.  I found all
kinds of interesting stuff with a var_dump($GLOBALS), however.  :)

As always, thanks everybody!

On Wed, Mar 18, 2009 at 5:16 AM, Waynn Lue <waynnlue@xxxxxxxxx> wrote:

> bash also has $HOME, which maps to /home/USERNAME, just in case you wanted
> another way.  :)
>
>
> On Tue, Mar 17, 2009 at 6:47 AM, George Larson <george.g.larson@xxxxxxxxx>wrote:
>
>> Thanks!
>>
>> On Tue, Mar 17, 2009 at 9:46 AM, Stuart <stuttle@xxxxxxxxx> wrote:
>>
>> > 2009/3/17 George Larson <george.g.larson@xxxxxxxxx>
>> >
>> > In my scripts, I usually define a boolean constant DEBUG.  True looks
>> for
>> >> local copies of includes and echoes queries as they're used.
>> >>
>> >> My question is:
>> >>
>> >> Is there any way for me to reflect the actual home folder of the person
>> >> running the script?  So it will be "/home/george/foo" when I run it
>> but,
>> >> for
>> >> another user, it would be "/home/their-username/foo"?
>> >
>> >
>> > $dir = realpath('~/foo');
>> >
>> > -Stuart
>> >
>> > --
>> > http://stut.net/
>> >
>>
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux