Dumb php question

software development

#1

I’m using a 3rd party hit counter, in a php script I inherited and ported from a prior hosting site. I had a little trouble getting it working at DH, but it’s OK now.
However, it uses a relative path to address ‘phpsessions’, and that’s just one more item I have to keep track of and update whenever I install the script on a new page, in a different directory. There must be a better way than:
“session_save_path(”…/…/…/phpsessions");"
Is there a non-relative path to my ‘root’ directory?

Thanks

Dave


#2

Your web root directory can be accessed by using the following superglobal array variable:

$_SERVER['DOCUMENT_ROOT'];This is functionally the same as:

/home/username/domain.com/--------
si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#3

Thanks!

So, am I looking at syntax like:

session_save_path($_SERVER[‘DOCUMENT_ROOT’]."/phpsessions");

(I really am new at php, if it wasn’t obvious!)

Dave


#4

Yup.


si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#5

Thanks! That worked…

Dave