My problem is that apache is displaying the source code of my python script [which just says Hello World] rather than giving it to the python interpreter to execute. Running the script in a shell produces the expected.
Using Gentoo 1.4, Apache 1.3.27, Python 2.2.2 and mod_python 2.7.8
Im sure that my problem is apache config related, but Ill explain my situation in full anyhow.
All relative programs have been emerged from the latest Gentoo portage tree.
I am able to run perl scripts fine in the cgi-bin and php scripts from the public_html directory. The python script im trying to run is chmodded 755 and *does* include the #!/usr/bin/python on the 1st line
I have added '-D PYTHON' to the startup script flags and when the server is started, the following is noted in error_log, so I gather than apache and python are happy
Quote:
Apache/1.3.27 (Unix) (Gentoo/Linux) mod_python/2.7.8 Python/2.2.2 PHP/4.3.0 configured -- resuming normal operations
|
/etc/apache/apache.conf includes the following:
Quote:
<IfDefine PYTHON>
LoadModule python_module extramodules/mod_python.so
</IfDefine>
|
and
Quote:
<IfDefine PYTHON>
AddModule mod_python.c
</IfDefine>
|
This file subsequently calls for the folloing configs:
Quote:
Include conf/commonapache.conf
Include conf/addon-modules/mod_python.conf
|
mod_python.conf mearly has the following...
Quote:
<IfModule mod_python.c>
AddHandler python-program .py
</IfModule>
|
commonapache.conf is somewhat longwinded ... but I have added the following while playing to try and get the scripts rendering. Using a little logic I added the following in the same section where the relevant .cgi and .php lines are:
Quote:
AddType text/x-script.python .py
AddHandler python-program .py
|
Does anyone have any ideas / spot any obvious mistakes? Note that I have followed the gentoo ebuild script and docs to the letter [from what I can see :P] and the only addition I have made are those last 2 lines to commonapache.conf.
Thanks in advance.