tags:

views:

379

answers:

3

On a CentOS LAMP box, trying to get require_once to work inside a script in PHP5. If the file to be included is not a in symlinked directory, it works fine, but if the file to be required is in a directory found via a symbolic link, it fails to find it.

Is this a limitation of require_once and symbolic links?

EDIT - Thanks for the input, all. I think it's most likely a permissions thing after reading those

+1  A: 

As far as I know there aren't. Are the permissions the same as when you don't use the sym link?

Darryl Hein
+2  A: 

To my knowledge, require_once can use symbolic links just fine. I'm using include_once with some symbolic links in a WordPress MU install and it works just fine - I can't imagine why require_once would function differently than include_once in that respect.

Any chance you've got open_basedir restrictions set?

ceejayoz
could be... thanks, I'll take a look into that
Flubba
+1  A: 

Can't you do something like the following?


   if (is_link($path))
   {
      $path = readlink($path);
   }
   require_once($path);

Andy