简体   繁体   中英

Cgi not executing python

I'm having a problem getting CGI to work for Python.

I've added

Options ExecCGI
AddHandler cgi-script cgi py pl

inside /etc/apache2/sites-available/default within

and now Perl works, but Python gives out a 500 Internal Server Error..

EDIT:

This if the current 'default' file

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride AuthConfig
            Order allow,deny
            allow from all

            AddHandler mod_python .py
            PythonHandler mod_python.publisher
            PythonDebug On
    </Directory>

    ScriptAlias /cgi-bin/ /var/www/cgi-bin/
    <Directory "/var/www/cgi-bin/">
            Options +ExecCGI
            AddHandler cgi-script .cgi .py .pl
            Allow from all
    </Directory>

Any ideas?

尝试将.py文件重命名为.cgi,它对我有用。

如果可以满足您的需求,请尝试使用python CGI服务器而不是apache。

python -m CGIHTTPServer {port number:default 8000}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM