Thomas Haase
Computer-generated Audio-visual Media
Front Page    Philosophy    Digital Processing    Contact    Impressum    


Mathematica CGI Web Interface
© Copyright 2000-2015 by Thomas Haase. All rights reserved.

The Mathematica CGI Web Interface provides a convenient remote access to an existing installation of Wolfram Mathematica via Internet or through any TCP/IP connection in general. Through this remote access, it is possible to use Mathematica from within any kind of operating system.
The interface consists of 100% pure Mathematica code. You are granted to use this interface for free, even commercially.

It provides 2-dimensional textual output and supports graphics and sound output.

Sample input:



Resulting output: (if possible, the computed pulsating sound is also played)


When using Mathematica 9.x, there are some minor problems with some multimedia output. This is not a bug of the interface because it is due to the disadvantageously changed invocation triggering of Mathematica's console display functionality. Generally, these problems can be circumvented by changing the interface's multimedia output technique from using custom redirecting default definitions for the display functions to an explicit application of a custom function that replaces the built-in multimedia-specifying functions' symbols with such ones of custom redirecting functions. But this alternative technique causes a loss of other important functionalities.
Shown below is a partial overview of the output behavior with Mathematica 9.x:


In order to satisfy as many demands as possible, the interface now offers the option to switch between both multimedia output techniques. In addition, it is possible to switch between the two transmission methods "GET" and "POST":


Multimedia Output Method: Standard -- Problems with Mathematica Ver. 9+
* Many graphics objects will not be rendered without an additional call of Show[].
* Some graphics objects will be output multiple times.

Multimedia Output Method: Alternative for Ver. 9+ -- Problems
* A multimedia result will only be output if it is produced by the last operation of the entire input.
* Any multimedia result will not be additionally displayed as its 1-dimensional raw InputForm representation ("Last Out") to be copied and re-used.
* A loss of backward compatibility with earlier versions of Mathematica occurs.

Transmission Method: GET
The maximum total length of the URL-encoded input (including the script file URL itself) is ca. one thousand or more thousands of characters, depending on the web server configuration. (Note that URL-encoding replaces special characters with three new characters each!)

Transmission Method: POST
The maximum total length of the URL-encoded input is virtually unlimited - unless an old version of Mathematica is used which may limit it down to only ca. 500 characters. (Note that URL-encoding replaces special characters with three new characters each!)


REQUIREMENTS:
  • Server side:
    • Windows 95 or higher;
      for usage on Unix/Linux (not tested), for configuring the web server, replace math.exe with math and %1 with $1, and in the interface script file, replace each occurrence of \\ with / (on Mac OS, replace math.exe with a reference to MathKernel or MathKernel64)
    • Any web server capable of using an executable file with arguments for CGI
    • Mathematica ver. 4.0 or higher (it may be possible that older versions can also be used)
    • That's all! - No other scripting language, middleware, MathLink executable etc. is needed!
  • Client side:
    • Any web browser supporting graphics
    • No JavaScript, Java, Flash, or other additional software is needed!

IMPORTANT: This web interface is not secure since it provides full access to
the Mathematica functionalities and through this also access to the host computer!
But this can be blocked by an appropriate configuration of Mathematica itself.


LEGAL NOTICE: This interface comes with no warranty at all!
The author is not responsible for any damage or loss due to using this interface!
Wolfram Research prohibits making the functionalities of a Mathematica installation generally available to the public!


SETUP:

The interface script file must be placed in the web server's htdocs directory.

Required Web Server Settings:
  * CGI Interpreter Executable: math.exe (of the Mathematica installation directory)
  * CGI Interpreter Executable's Arguments for Mathematica 4.0 to 7.0.1: -noprompt -initfile "%1"
  * CGI Interpreter Executable's Arguments for Mathematica 8.0 and up: -noprompt -script "%1"
  * CGI Interpreter Executable's Associated File Name Extension: m
On Unix/Linux or when using an Apache web server, it may be easier instead to define a "ScriptAlias" for the htdocs directory and an "AddHandler cgi-script" for the file name extension .m, and to insert an appropriate shebang line at the top of the interface script file, containing the path to "math" followed by the arguments, e.g. in the following form:
#!/usr/local/bin/math -noprompt -script
For this, you may have to set up an adjustment to enable passing multiple arguments from the shebang, or you can try leaving out the argument -noprompt


Before using, in the web server's htdocs directory, manually create the subdirectory "TMPMATH"

The providing of computation time and memory per input can be arbitrarily adjusted.

For further details, refer to the comments within the interface script file itself.

-> DOWNLOAD <- (Ver. 002/2014, June 9, 2014)




© Copyright 2008-2015 by Thomas Haase. All rights reserved.

Front Page    Philosophy    Digital Processing    Contact    Impressum