Since Raspberry pi has a free version ma, I am wondering how to interface it with php on web.
I write some simple code as
<?php
$math="/opt/Wolfram/WolframEngine/10.0/Executables/math -batchinput -batchoutput";
?>
<!DoCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Mathematica on Raspiberry pi</title>
</head>
<body>
<div id="wrap">
<h1>Mathematica on Raspiberry pi</h1>
<h3>Input your expression</h3>
<div id="stdin">
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input name="stdin" />
<input type="submit" value="Evaluate" />
</form>
</div>
<h3>The Results</h3>
<div id="stdout">
<?php
$cmd=$_POST['stdin'];
echo $math($cmd);
?>
</div>
</div>
</body>
</html>
The problem is that the output can't work (although the $math command can interface in terminal).
$math
is a string, how could this possibly work? Have a look at exec(). $\endgroup$echo exec($math.' '.$cmd);
still not work. $\endgroup$