Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing include path using php script

Tags:

php

I'm looking to include other folders in my include path for PHP. I've seen this question:

Setting PHP Include Path on a per site basis?

BUT I don't want to replicate the system path (I suppose I could but then it won't update if the system path is updated). What I would rather is to simply have a line which looked like:

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

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

like image 569
cgp Avatar asked Aug 24 '26 10:08

cgp


1 Answers

I think you are looking for this: set_include_path

With it, you can do:

set_include_path(get_include_path() . PATH_SEPARATOR . $otherpath);
like image 91
Paolo Bergantino Avatar answered Aug 26 '26 00:08

Paolo Bergantino



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!