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!
anirvana
 
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.
Wiedmann
AF Moderator
 
Posts: 17102
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

change

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


to

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
#!/usr/bin/python


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.
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 175 guests