Is it possible to create a standalone CGI executable to deploy my application on the web using the MATLAB Compiler?
21 views (last 30 days)
Show older comments
MathWorks Support Team
on 10 Sep 2012
Commented: Vandana Ravichandran
on 22 Feb 2017
I want to deploy my application on the Web. I want to write all my code in MATLAB and compile it with the MATLAB Compiler.
Accepted Answer
MathWorks Support Team
on 10 Sep 2012
Using MATLAB Compiler you can create a standalone executable which can be called by your web server using the Common Gateway Interface (CGI).
A CGI program or script outputs HTML by printing it to the screen (stdout). Input to a CGI program is through the environment variable "QUERY_STRING". By using the MATLAB functions GETENV and FPRINTF you can create a simple CGI program.
Before attempting the following, you should verify that you have configured your web server properly in order to run CGI programs, and that you are able to execute a CGI program that is independent of MATLAB. Consult your web server documentation for how to do this.
An example has been created which demonstrates how to do this. The files for this example are located in the file CGI_Standalone.zip. The download link is present at the bottom of this page. Perform the following steps to compile and run this example:
1. Compile the MATLAB file into a standalone application. This can be done with the following command in MATLAB:
mcc -m mycgimagic.m
2. Copy the HTML file to the web server and place it in a directory with the proper permissions. Consult your web server documentation for how to do this.
3. Copy the EXE and CTF files to the web server and place them in the "/cgi-bin" directory of your website. You will need to configure the web server to have the proper permissions to be able to execute the EXE-file. Consult your web server documentation for how to do this.
4. Install the MCR on the web server.
5. Execute the EXE-file for the first time from the web server system itself in order to force the CTF-archive extraction.
6. Load the HTML-file in a web browser from the remote computer and submit the form to execute the CGI program.
For more information on standalone applications, see the MATLAB Compiler documentation and C standalone application target example.
7 Comments
More Answers (0)
See Also
See Also
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!