Change includes path using php script

I want to include other folders in my include path for PHP. I saw this question:

Configure PHP Include Path for each site?

BUT I do not want to replicate the system path (suppose I could, but then it will not be updated if the system path is updated). I would prefer to just create a line that looks like this:

ini_set ('include_path', ini_get ('include_path'). $ otherpaths);

Will this work, and is there some kind of fundamental readon, is it bad?

+3
source share
1 answer

I think you are looking for this: set_include_path

With it, you can:

set_include_path(get_include_path() . PATH_SEPARATOR . $otherpath);
+4
source

Source: https://habr.com/ru/post/1707650/


All Articles