PHP apache Korn script
Posted: Sat Feb 02, 2008 8:11 am
Hello,
I have a simple Korn shell script and I am trying to call it from PHP and it always return the error leg of the statement from the browser. However, if I execute the php script from the shell command prompt it work fine.. I tried exec, exec_shell but i get the same result..
Thanks in advance for any help.
here is the code
SHELL SCRIPT[prem.ksh]
-------------------------
PHP SCRIPT
I have a simple Korn shell script and I am trying to call it from PHP and it always return the error leg of the statement from the browser. However, if I execute the php script from the shell command prompt it work fine.. I tried exec, exec_shell but i get the same result..
Thanks in advance for any help.
here is the code
SHELL SCRIPT[prem.ksh]
Code: Select all
#!/bin/ksh
# main runtime
KEY=$1
echo $KEY
EMAILTEST=`echo $KEY | /usr/local/bin/egrep -i [A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$ | wc -l
`
if [[ $EMAILTEST -eq 0 ]]; then
echo ERROR: The email address \"$KEY\" is not in a valid email form..
exit -1
else
echo $EMAILTEST
fi
PHP SCRIPT
Code: Select all
<?php
$command = '/home/pb0581/prem.ksh prem.temp@companyy.com ';
$x = system($command,$output);
echo "ret_error = ".$x;
echo "<br />";
echo $output;
echo "<br />";
?>