简体   繁体   中英

Is it possible to set PHP CLI include_path from environment?

Is there a way to set (or add to) the PHP include_path from an environment variable when running CLI PHP? I'm looking for the PHP analog to Java's CLASSPATH or Perl 5's PERL5LIB. My gut tells me it should be there, but I can't find it.

If there really is no such thing, then I guess the follow-up is: is there a best practice for achieving this? Keep in mind that, in my case, the include_path should not be the same for all users, or even for every application.

This other answer points out that you can use the -d argument to set include_path in the CLI.

 php -d include_path=/path/to/config.php script.php 

-d is used to set INI directives at runtime, so you don't have any changing code/configs/directories

Note: @Ismael answered this in a comment, I just moved the info to an answer, where it stackoverflowily should be.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM