Why do I get malformed header errors when using a MATLAB Compiler-generated standalone application as a CGI application with Apache?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
Réponse acceptée
MathWorks Support Team
le 27 Juin 2009
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Workspace Variables and MAT Files dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!