I'm in the process of migrating a site from one server to another. On the old server, getcwd() returns the directory that the script is running, all of the time. On the new server, in one of my scripts, once it goes inside a function, getcwd() returns root. Outside the function though, it returns the correct directory. Could this be due to the different server APIs being used? (old server uses CGI/FastCGI, new on uses Apache 2.0 handler)
EDIT: I'm actually not relying on getcwd() in the code, but is_readable(). I'm just checking using getcwd() because I was told is_readable() (which isn't working) relies on the cwd