Jump to content

Archived

This topic is now archived and is closed to further replies.

akitchin

Filesystem path issues

Recommended Posts

hey there,

 

i often define a system path variable with the filesystem-based path to the current working directory, like so:

 

define('SYS_PATH', '/projects/somedir/somesubdir');

 

where projects is a directory immediately below the directory set as my localhost.  this works on *nix machines, but the path seems to trump any windows machines with a "The file cannot be found" error:

 

require_once(SYS_PATH.'/includes/something.php');

 

the path echoed in the error is exactly the path to the file, and the file is there.  furthermore, the filesystem path in the $_SERVER array is the one i use in SYS_PATH, so i see no reason why it should work on *nix but not windows.

 

anyone know of some discrepancies between directory handling?  all server settings are the same, the only difference being in the OS.  i'd appreciate any help, since this makes local testing utterly useless.

Share this post


Link to post
Share on other sites

bumpity bump bump.  nobody has any insights?

Share this post


Link to post
Share on other sites

going to bump this again, one last time.

Share this post


Link to post
Share on other sites

its hard to tell because we dont know the dir we use that style i our site but maybe all i can say is that you echo the full path in the include to see where you went wrong if you can do that without using the define then it has no diff with define

Share this post


Link to post
Share on other sites

I think on windows the working dir is stored with a "/" at the end. it should work if you take the "/" off the beginning of your path.

define('SYS_PATH', 'projects/somedir/somesubdir');

 

You might even need to put a "/" at the end of it too, in some cases, I'm not sure.

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.