[CentOS] Re: centos] php on command line problems

Mon Apr 3 13:51:08 UTC 2006
R P Herrold <herrold at owlriver.com>

On Fri, 31 Mar 2006, Kai Schaetzl wrote:

> The installed php on CentOS/RHEL is the CGI version. This means I should
> be able to get command line arguments with $GLOBALS['argv'] or
> $_SERVER['argv']. That's how the php documentation tells and how it works
> f.i. on Suse.

with an utterly stock Centos, this code fragment 'just works', 
including database access:

[herrold at centos-4 gnuplot]$ grep -v ^$ plots.php | grep -v ^#$   \
 	| head -20
#!/usr/bin/php -qc/etc
<?php
$screen = 1 ;
$screen = 0 ;
$ARGC = $_SERVER["argc"];
$ARGV = array();
$ARGV = $_SERVER["argv"];
//
include("/home/herrold/shim/database_trender_keying.php");
include("/home/herrold/shim/database_trender_open.php");
include("/home/herrold/shim/database_beancounter_keying.php");
include("/home/herrold/shim/database_beancounter_open.php");
//
$demog_value = array();
//
$nonce = $ARGC ;
$counter = 0 ;
// print "$ARGC: \n";
while ( $nonce > 1 ) {
   $nonce -= 1 ;
   $counter += 1 ;
  ...

-- Russ Herrold