Re: Always building command line PHP
| From: | J Smith | Date: | Thu, 03 Jan 2002 21:26:38 +0000 |
| Subject: | Re: Always building command line PHP | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-75802@lists.php.net to get a copy of this message | ||
Actually, I wouldn't mind having seperate php.ini files for the web server
module and for the CLI executeable, either.
Here's what happened to me recently -- I had upgraded my servers from 4.1.0
(one of the release candidates, I've been following PHP development rather
closely) to 4.1.0 final. I also started using the Zend Optimizer, which I
had been using with 4.0.6, but not with the 4.1.0 RCs as there was no
Optimizer compatible with them at the time.
Everything was fine with all of the stuff we had for the web server, that
is, all of the stuff that used Apache and the statically compiled PHP
module, but when it came time to use the CLI (which we use for things like
our search engine and some cron scripts), none of the CLI stuff worked
because I had used the CLI's pcntl extension. Y'see, the Optimizer wouldn't
let the CLI executeable run with the pcntl extension loaded, giving the
following error:
PHP Fatal error: [Zend Optimizer] Zend Optimizer 1.2.0 is incompatible
with pcntl 1.0 in Unknown on line 0
I basically had to make two php.ini files, one for the Apache module with
the Optimizer enabled (the default php.ini) and one for the CLI without the
Optimizer. This isn't an overly big deal, but now I had to prefix all of
our CLI scripts to begin with the somewhat ugly
#!/usr/local/bin/php -c /usr/local/zend/etc/cli -q
instead of just
#!/usr/local/bin/php -q
It's also kind of a pain to have to type all that jazz out when I just want
to test a quick script, like <?php print "blah"; ?> at the command line,
i.e.
[user@somehost]# php -c /usr/local/zend/etc/cli
<?php print "blah"; ?>
^D
just to test something simple at the command line, when the command could
just be truncated to "php".
Just a little annoyance I guess. Nothing to get in knots over. But in the
end, I would prefer separate php.ini files, maybe something like
php-cli.ini for the default CLI file and and php.ini for the Apache/web
server module default. If php-cli.ini doesn't exist, the CLI can always
fall back on php.ini, which would be the default in any case.
Just a suggestion, though.
J
Jon Parise wrote:
> On Wed, Jan 02, 2002 at 04:39:24PM +0000, php4@developersdesk.com wrote:
>
>> One thing to consider, at least the php.ini location needs to be
>> different between the module and command line compiles. I suspect most
>> people will have quite a few other differences in ./configure options
>> between them too. I know I do.
>
> I don't see the necessity of requiring different php.ini files.
>
> You can specify the php.ini by using the -c option to the php
> binary, as well.
>