xampp for PYTHON

Alles, was den Apache betrifft, kann hier besprochen werden.

xampp for PYTHON

Postby anirvana » 21. September 2009 18:18

I want to use apache server to execute my python scripts .Is it possible?
Does xampp has internal support for it?
Please help me out!
Posts: 1
Joined: 21. September 2009 18:11

Re: xampp for PYTHON

Postby Wiedmann » 21. September 2009 18:44

python scripts ... Does xampp has internal support for it?

Python is not part of any XAMPP package.
AF Moderator
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: xampp for PYTHON

Postby Nobbie » 21. September 2009 21:10

SImply add .py extension to the AddHandler directive in httpd.conf


Code: Select all
AddHandler cgi-script .cgi .pl


Code: Select all
AddHandler cgi-script .cgi .pl .py

if you like to run Python Scripts (*.py) from anywhere inside your server. Restart Xampp after editing httpd.conf

Or simply put your Python Scripts into /opt/lampp/cgi-bin and you can call them via http://localhost/cgi-bin/scriptname.py (you may replace "localhost" by another domain name, if Xampp also runs on a public server).

In BOTH cases, you MUST supply a working "Shebang Line" (the very first line of your scripts) to every Python Script, which points to the Python interpreter. Example:

Code: Select all

As python is NOT part of Xampp, it must be installed somehow else. All Linux distributions are coming with a standard python interpreter, if it is not installed by default, you have to install it via your system specific installation tools.
Posts: 11714
Joined: 09. March 2008 13:04

Return to Apache

Who is online

Users browsing this forum: No registered users and 10 guests