Jump to content

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.

Link to comment
https://forums.phpfreaks.com/topic/47932-filesystem-path-issues/
Share on other sites

  • 2 weeks later...
  • 3 months later...

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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