Jump to content

[SOLVED] Files not being included with set_include_path() or ini_set('include_path')


Recommended Posts

I cannot seem to wrap my head around this peculiar problem. I have tried using both the function to set my include path, and then echo the get_included_files() and the files do not appear in the array. I can use require() or include() with no problems, but when I try to set the include path, the files do not seem to be included. Is there some weird quirck or gotcha to using this feature of PHP? I thought all you have to do is provide the directory and viola it should work. Any advice?

 

 

Thanks.

Just because the files are in your path does not meen they are included automatically. It just meens instead of typing the full path, you can use just the filename. ie:

 

<?php

  set_include_path(get_include_path(). ';' . '/foo/bar');
  include 'file.php';

?>

 

Instead of....

 

<?php

  include '/foo/bar/file.php';

?>

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.