The following shell command will send mail from my Raspbbery:
mailnotify.sh "Test" "Dies ist eine Testnachricht."
Following try, starting this shell script using PHP will result to error:
/usr/local/bin/mailnotify.sh: 72: [: 1: unexpected operator
Why? How to pass parameters in correct way?
$parameter1="Test";
$parameter2="Dies ist eine Testnachricht.";
$parameter1=escapeshellarg($parameter1);
$parameter2=escapeshellarg($parameter2);
shell_exec("mailnotify.sh $parameter1 $parameter2");//won't run
shell_exec('mailnotify.sh "'.$parameter1.'" "'.$parameter2.'"');//won't run, too