Hi, I am researching on Python language, its syntax and other features are as easy as others' but I want to use it as a server-side scripting language like PHP with Apache Web Server (AppServ) but it seems to very difficult, I think I have to change some info in configuration file but what to change are not easy to find out for me. My want is very simple, for example, I have the following HelloWorld python file:
#!E:/Python32/python.exe
print("Hello World!")
and I save it as "HelloPython.py" and save it in "E:/AppServ/www/cgi-bin/"
and I want when users type "http://localhost/cgi-bin/HelloPython.py" in the Address bar of a browser, hit enter and it should display the "Hello World!".
I have searched a little with Google and tried some things like:
Options +ExecCGI
AddHandler cgi-script .py .pl
And it seemed that the changes to the configuration file took effect when the server threw back a message like "Internal Server Error" and I opened the Server error log file to see exactly what happened and it said "malformed header from script. Bad header=Hello World!: HelloPython.py". Well, malformed header??? I saved my python file using ANSI option from the save file dialog of NotePad, what's wrong with that?
Could your please help me out this complexity? I can feel it's not easy at all.
Your help would be highly appreciated anyway, thanks!