XAMPP + Python = Malformed header from script (Error 500)

Problems with the Windows version of XAMPP, questions, comments, and anything related.

XAMPP + Python = Malformed header from script (Error 500)

Postby Batric » 20. November 2010 12:24

Hi everyone,

I am trying to get Python working on XAMPP. I'm running Windows Vista, XAMPP version 1.7.1., PHP is working without any problems.

I followed the instructions from here:

http://www.macouno.com/2010/03/17/getti ... -on-xampp/

I did everything the same, restarted Apache service, rebooted the PC but still I get the following error:

Code: Select all
Server error!

The server encountered an internal error and was unable to complete your request.

Error message:
malformed header from script. Bad header=Works!: index.py

If you think this is a server error, please contact the webmaster.
Error 500
11/20/10 12:19:37
Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9

Btw, I wanted to install mod_python for Windows, but seems that the download section is not working (at least for the last 7 days):

Any idea how to get this working?

Thanks a lot in any case

Posts: 8
Joined: 07. December 2008 17:12

Re: XAMPP + Python = Malformed header from script (Error 500

Postby JonB » 20. November 2010 17:27

Python is working - what that meesgae is telling you is that your Python script has errors - its not a XAMPP problem. (although I am NOT a Python expert - I am very familiar with getting this same error with Perl scripts - another CGI enabled language)

It often means a syntax error, you are missing required elements to output (like document type stuff to output) or that you have not done things in the right order.

http://wiki.python.org/moin/CgiScripts (look at that example)

mod_python is a different issue, its like mod_perl - an Apache extension/module.

Good Luck
User avatar
AF Moderator
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: XAMPP + Python = Malformed header from script (Error 500

Postby Batric » 20. November 2010 18:05

Thanks a million! You were right - the header information was missing

It's working now :)

This was the catch - before printing anything else, I should print out this:

Code: Select all
print "Content-Type: text/html; charset=utf-8\n\n";

Same as for Perl

Thanks again!
Posts: 8
Joined: 07. December 2008 17:12

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 35 guests