I'm trying to pass arguments back and forth, from shell to PHP, and back again. In my simple test, I'm getting easily from shell into PHP, but having no luck getting strings back out. I've tried both escapeshellarg and escapeshellcmd, but neither worked.
Shell
#!/bin/sh
# set a date and time variables, in the form of YYYY-MM-DD and HH:MM:SS
dateVar=`date +%Y-%m-%d`
timeVar=`date +%H_%M`
# Launching PHP
runPHP=`which php`
$runPHP calledPHP.php $timeVar $dateVar
# Returned from PHP
passTime=$1
echo "$passTime"
passDate=$2
echo "$passDate"
PHP
<?php
setlocale(LC_CTYPE, "en_US.UTF-8");
echo "PHP called.\n";
$logTime = $argv[1]."\n";
// echo $logTime;
$logDate = $argv[2]."\n";
// echo $logDate;
$passTime = escapeshellarg('Time: $logTime');
$passDate = escapeshellarg('Date: '.$logDate);
?>
Running the shell, the only echo that it get back is 'PHP called.' As you can see, I've tried two different syntaxes in the last two php variables. Neither seem to work. Is there a better function for this? Or, am I just using the wrong syntax?
Thanks in advance for any suggestions