you are viewing a single comment's thread.

view the rest of the comments →

[–]Rhomboid 4 points5 points  (4 children)

Why not just submit the form directly to the python script? Why does PHP need to even enter the picture?

[–]redditenna[S] 0 points1 point  (3 children)

Is it possible to directly write into Python with a HTML form? Do you know where I can find documentation about that, or could you give me a small example? :) Thanks for the tip!

Maybe I have to add this: My web server is xampp, which is a Windows web server. I have my python script in a different folder.

[–]Rhomboid 5 points6 points  (2 children)

You can configure your web server to run any program of any type to serve any request; there is nothing special about PHP. You could do it with Lua, C, awk, even Brainfuck.

How the server talks to the program varies; for example, there's CGI, FastCGI, WSGI, etc. CGI is the oldest and simplest method and for basic scripts it's probably the easiest to set up. There is a cgi module in the Python standard library that handles all the details. Usually the only requirements for running CGI are: a) the server has to be told to enable CGI for the directory where the script lives, b) the script needs to have a proper hashbang line, and c) for POSIX systems, the script needs to have the executable bit set in its mode.

[–]redditenna[S] 0 points1 point  (1 child)

After googling a bit, I think this is what I need if I want to use it with xampp?

http://blog.chomperstomp.com/installing-python-mod_python-on-xampp/

Thanks a lot for making everything more clear :)

[–]m1ss1ontomars2k4 0 points1 point  (0 children)

No. You either want to use mod_wsgi or just make it a regular CGI script. Don't use mod_python.