#!/bin/sh

# first find which PHP binary to use
if test "x$PHP_PEAR_PHP_BIN" != "x"; then
  PHP="$PHP_PEAR_PHP_BIN"
else
  if test "/usr/local/bin/php" = '@'php_bin'@'; then
    PHP=php 
  else
    PHP="/usr/local/bin/php"
  fi
fi

# then look for the right pear include dir
if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then
  INCDIR=$PHP_PEAR_INSTALL_DIR
  INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR"
else
  if test "/var/www/pear/lib" = '@'php_dir'@'; then
    INCDIR=`dirname $0`
    INCARG=""  
  else
    INCDIR="/var/www/pear/lib"
    INCARG="-d include_path=/var/www/pear/lib"
  fi
fi

exec $PHP -C -q $INCARG -d output_buffering=1 $INCDIR/pearcmd.php "$@"
