LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-07-2005, 02:18 PM   #1
gaddargarson
LQ Newbie
 
Registered: Sep 2004
Location: izmir
Distribution: mandrake,GBL,fedora core,slackware
Posts: 26

Rep: Reputation: 15
mod_python apache configuration


Hi.I'm using Slackware 10.0 and I 've compiled httpd server( 2.0.53) from tar.gz package. My Apache server is working successfully. Then I wanted to integrate mod_python(3.1.4). I 've compiled it too.(installation completed without any error.)But I couldn't make its Apache configuration.
Is there anybody who can tell me mod_python's Apache configuration step by step? I've read the manual carefully and made the changes as it was said in the
manual. There is a testing part in the manual that you can understand whether
your mod_python module works successfully. But it didn't worked.

Here is the testing part of the mod_python manual;

2.4 Testing

Make some directory that would be visible on your web site, for example, htdocs/test.

Add the following Apache directives, which can appear in either the main server configuration file, or .htaccess. If you are going to be using the .htaccess file, you will not need the <Directory> tag below (the directory then becomes the one in which the .htaccess file is located), and you will need to make sure the AllowOverride directive applicable to this directory has at least FileInfo specified. (The default is None, which will not work.)

<Directory /some/directory/htdocs/test>
AddHandler mod_python .py
PythonHandler mptest
PythonDebug On
</Directory>

(Substitute /some/directory above for something applicable to your system, usually your Apache ServerRoot)


At this time, if you made changes to the main configuration file, you will need to restart Apache in order for the changes to take effect.

Edit mptest.py file in the htdocs/test directory so that is has the following lines (be careful when cutting and pasting from your browser, you may end up with incorrect indentation and a syntax error):

from mod_python import apache

def handler(req):
req.write("Hello World!")
return apache.OK


Point your browser to the URL referring to the mptest.py; you should see "Hello World!". If you didn't - refer to the troubleshooting section next.


How can I run mod_python
 
Old 03-08-2005, 01:06 PM   #2
wpn146
Member
 
Registered: Jan 2005
Distribution: Solaris, Linux Fedora Core 6
Posts: 170

Rep: Reputation: 30
Unless you have mod_python compiled into apache, you will need the following line added to the end of your other LoadModule lines:
Code:
LoadModule python_module      libexec/mod_python.so
and at the end of your AddModule lines:
Code:
AddModule mod_python.c
Then your little "hello world" test should run. After you have this working, you will probably want to use a more general purpose handler, for example:
Code:
        PythonHandler mod_python.publisher
There are other handlers to choose from. I am the sys admin, not the end user, so you will have to research how to use the publisher, and other, handlers. I just tried to google "mod_python.publisher" and hit a bunch of security vulnerability concerns, so use caution.
 
Old 03-09-2005, 05:14 AM   #3
gaddargarson
LQ Newbie
 
Registered: Sep 2004
Location: izmir
Distribution: mandrake,GBL,fedora core,slackware
Posts: 26

Original Poster
Rep: Reputation: 15
I understood my mistake. I wasn't editing the mptest.py file correctly. So there 've become a syntax error. Now I can see "Hello world" at my browser.


I want to add a note to wpn146. You don't need to add this line °AddModule mod_python.c ° to httpd 2.0.xx versions.And I think it will be better to putting
the complete path of "mod_python.so" in the first code instead of libexec.
Thanks wpn146
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with mod_python tiang_ono Linux - Newbie 2 06-20-2005 08:12 PM
mod_python gaddargarson Programming 1 03-29-2005 08:45 AM
installing mod_python dominant Linux - Software 0 11-26-2004 06:19 AM
Apache and mod_python not exec python scripts fIREfox Linux - Networking 1 02-11-2003 05:54 PM
Apache with mod_python mbayeb Linux - Software 2 12-24-2002 05:24 AM


All times are GMT -5. The time now is 09:22 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration