Connecting Oracle in PHP using command line, will need to set some environment variable as below.
Below is the code snippet for Shell script, all export variable are necessary in term of command line execution.
------------------------------------------------------
### Cron for Purpose
#export ORACLE_SID=ONLDB
export ORACLE_BASE=/usr/local/oracle92/
export ORACLE_HOME=$ORACLE_BASE
#export ORACLE_TERM=vt100
#export NLS_LANG=american
#export ORA_NLS33=$ORACLE_BASE/ocommon/nls/admin/data
#export LD_LIBRARY_PATH=$ORACLE_BASE/lib:/lib:/usr/lib:/usr/local/lib
export PATH=$PATH:$ORACLE_BASE/bin
#export ORACLE_BIN=$ORACLE_BASE/bin
### Unpublished Product Job since last 3 days
php /path/to/cron/file.php
Below is the code snippet for Shell script, all export variable are necessary in term of command line execution.
------------------------------------------------------
### Cron for Purpose
#export ORACLE_SID=ONLDB
export ORACLE_BASE=/usr/local/oracle92/
export ORACLE_HOME=$ORACLE_BASE
#export ORACLE_TERM=vt100
#export NLS_LANG=american
#export ORA_NLS33=$ORACLE_BASE/ocommon/nls/admin/data
#export LD_LIBRARY_PATH=$ORACLE_BASE/lib:/lib:/usr/lib:/usr/local/lib
export PATH=$PATH:$ORACLE_BASE/bin
#export ORACLE_BIN=$ORACLE_BASE/bin
### Unpublished Product Job since last 3 days
php /path/to/cron/file.php
--------------------------------------------------------------------