[UPHPU] setting path for command line PHP script
Richard K Miller
richardkmiller at gmail.com
Wed Oct 29 09:41:34 MDT 2008
>> What's the equivalent for the command line? Should I do something
>> like this?
>>
>> $ export php_include_path="/Users/richard/Sites/example.com/inc"
>>
>> <?php
>> ini_set('include_path', getenv('php_include_path'));
>> ?>
>>
>> Is there an environment variable PHP will automatically read for
>> includes?
>> I'd prefer not to have to explicitly set it myself.
>
> Your include_path should either be set in the php.ini file, or inside
> the script itself via ini_set()
>
> You can specify a different php.ini file with php -c /path/to/php.ini
>
> Your idea in using your own custom environment variable could work,
> but is a bit hackish IMHO.
I agree that my method is hackish. But I don't want to set the
include_path in my script, which would make it less portable across
dev/production machines, and I don't want to specify the -c flag every
time I run a script. I guess laziness is winning over elegance. :)
More information about the UPHPU
mailing list