• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 373
  • Last Modified:

set_include_path

Ok, here what I do. I change the  include_path using
$currentInc = get_include_path();
$documentRoot = $_SERVER['DOCUMENT_ROOT'];
$documentRoot = explode('/',$documentRoot);
$documentRoot = join(DIRECTORY_SEPARATOR,$documentRoot);
$pathInc = $documentRoot.DIRECTORY_SEPARATOR.'libs'.DIRECTORY_SEPARATOR.PATH_SEPARATOR.
               $documentRoot.DIRECTORY_SEPARATOR.'libs'.DIRECTORY_SEPARATOR.'functions'.DIRECTORY_SEPARATOR.PATH_SEPARATOR.
               $documentRoot.DIRECTORY_SEPARATOR.'libs'.DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.PATH_SEPARATOR.
               $documentRoot.DIRECTORY_SEPARATOR.'libs'.DIRECTORY_SEPARATOR.'incs'.DIRECTORY_SEPARATOR.'cj'.DIRECTORY_SEPARATOR.'ads'.DIRECTORY_SEPARATOR.PATH_SEPARATOR.
               $documentRoot.DIRECTORY_SEPARATOR.'libs'.DIRECTORY_SEPARATOR.'incs'.DIRECTORY_SEPARATOR.'google'.DIRECTORY_SEPARATOR.'adsense'.DIRECTORY_SEPARATOR.PATH_SEPARATOR.
               $documentRoot.DIRECTORY_SEPARATOR.'libs'.DIRECTORY_SEPARATOR.'incs'.DIRECTORY_SEPARATOR.'google'.DIRECTORY_SEPARATOR.'analytics'.DIRECTORY_SEPARATOR.PATH_SEPARATOR.
               $documentRoot.DIRECTORY_SEPARATOR.'libs'.DIRECTORY_SEPARATOR.'incs'.DIRECTORY_SEPARATOR.'sections'.DIRECTORY_SEPARATOR.PATH_SEPARATOR.
               $documentRoot.DIRECTORY_SEPARATOR.'libs'.DIRECTORY_SEPARATOR.'services'.DIRECTORY_SEPARATOR.'starrate'.DIRECTORY_SEPARATOR.PATH_SEPARATOR.
               $documentRoot.DIRECTORY_SEPARATOR.'libs'.DIRECTORY_SEPARATOR.'services'.DIRECTORY_SEPARATOR.'greybox'.DIRECTORY_SEPARATOR.PATH_SEPARATOR.
               $documentRoot.DIRECTORY_SEPARATOR.'libs'.DIRECTORY_SEPARATOR.'fonts'.DIRECTORY_SEPARATOR;
set_include_path($currentInc.PATH_SEPARATOR.$pathInc);

so what I assume, whenever I use require or require_once, the file will be searched in these directories.
There is a top.php file under /libs/incs/sections directory and index.php file in the root directory. When I try require_once('top.php') I get
Fatal error: require_once() [function.require]: Failed opening required

So if I am adding this dir in the include_path, why it can't find it?

Thanks
0
bilgehanyildirim
Asked:
bilgehanyildirim
1 Solution
 
cg_medistoxCommented:
My suggestion, although this will not solve the problem is..

echo $currentInc.PATH_SEPARATOR.$pathInc;

After where you set all the variables and just make sure that it is looking in the correct place for the files.

Im aware you have probably already tried this but i would be interested to see the results
0
 
bilgehanyildirimAuthor Commented:
Problem solved. It was just a typo :)))
Thanks for your time...
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now