Why do I get malformed header errors when using a MATLAB Compiler-generated standalone application as a CGI application with Apache?
6 次查看(过去 30 天)
显示 更早的评论
I have created a standalone executable, mycgimagic.exe, with MATLAB Compiler which is being called by my web server as a CGI application. In the program I am using DISP to print out the formatted HTML.
When I use this application with Microsoft's Internet Information Services (IIS) web server it works fine. However when it is used with Apache Web Server 2.2, I receive an Internal Server Error and the following message is in the Apache log file
malformed header from script. Bad header= : mycgimagic.exe
采纳的回答
MathWorks Support Team
2009-6-27
This error is caused by the automatic formatting done by the DISP command. Apache seems to be more particular about the formatting of the content-type headers in the HTML file than IIS.
To work around this issue, replace every occurrence of the DISP command with PRINTF. For example the command
disp('Content-type: text/html');
should be replaced with
fprintf(1,'Content-type: text/html\n');
After making these changes, the same program should work for both web servers.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!