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

$math="/opt/Wolfram/WolframEngine/10.0/Executables/math -batchinput -batchoutput";
    <!DoCTYPE html>
        <meta charset="UTF-8" />
        <title>Mathematica on Raspiberry pi</title>
        <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" />
      <h3>The Results</h3>
      <div id="stdout">
        echo $math($cmd);

The problem is that the output can't work (although the $math command can interface in terminal).

  • $\begingroup$ $math is a string, how could this possibly work? Have a look at exec(). $\endgroup$
    – C. E.
    Apr 23, 2015 at 14:52
  • $\begingroup$ thanks, but echo exec($math.' '.$cmd); still not work. $\endgroup$
    – van abel
    Apr 23, 2015 at 15:14
  • $\begingroup$ I also fonund the ma API maybe helpful: products.wolframalpha.com/docs/PHP_Binding_0_1.zip $\endgroup$
    – van abel
    Apr 23, 2015 at 15:51


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.