2

So, i'm currently working on a Android app. Everything work just fine so far, but i'm facing an annoying problem : I can't seem to be able to run a python script on my server.

The first thing I tried was to call a php function that execute the python script and return what i want to display. It works fine when I'm doing it on the shell (with php myPhpfile.php), I get what I want which is nice. But when I try to do it on my lampp server, the .py doesn't return anything.

I know there's a few step-by-step about how to enable python with cgi on lampp, but it didn't seems to work (I was probably doing it wrong, though). But I know it's possible to launch the python script directly from the application (with a http://ip_of_the_server/cgi-bin/myscript.py). So how can I properly configure the cgi-thing ? I mean, I have the cgi-bin directory in my /opt/lampp, and I tried to do the thing with ScriptAlias and Directory. So, my httpd.conf (in /opt/lampp/apache2/conf) is like that now :

Alias /bitnami/ "/opt/lampp/apache2/htdocs/"
Alias /bitnami "/opt/lampp/apache2/htdocs"

<Directory "/opt/lampp/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

<Directory "/usr/lib/cgi-bin/">
    AddHandler cgi-script .cgi .py
    AllowOverride All
    Options +Indexes FollowSymLinks +ExecCGI
    Order allow,deny
    Allow from all
</Directory>

When I try to run my apache server with the xampp console... Nothing append. Apache doesn't begin to run. So... What am I doing wrong ?

GAD3R
  • 4,317
  • 1
  • 23
  • 34

1 Answers1

0

Have A Look At This Video From Youtube.

You Should Save Your CGI Files In The /usr/lib/cgi-bin/ Directory.

You Also Need libapache2-mod-wsgi.

And By The Way, If You Are Using Any GNU/Linux Distributions, Try To Install LAMP Stack Or LEMP Stack, Rather Than Third Party Applications Like XAMPP From Bitnami Or etc.

Sadegh Alirezaie
  • 343
  • 1
  • 3
  • 17