[UPHPU] setting path for command line PHP script

Lonnie Olson lists at kittypee.com
Tue Oct 28 17:33:37 MDT 2008


On Tue, Oct 28, 2008 at 3:14 PM, Richard K Miller
<richardkmiller at gmail.com> wrote:
> 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.

--lonnie


More information about the UPHPU mailing list