LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-03-2012, 10:04 AM   #1
ashish hasani
LQ Newbie
 
Registered: Apr 2012
Posts: 1

Rep: Reputation: Disabled
could not execute bin folder of a package from cgi bin script using python


#!/usr/bin/python
import cgi, cgitb
cgitb.enable()
import os
import sys
form = cgi.FieldStorage()
pdb1 = form.getvalue('pdb')
template1 = form.getvalue('template')
os.chdir("/home/ashish/project/findsite-1.0/src")
os.system('../bin/findsite -s pdb1 -t template1 -o pdb1.findsite')

print "Content-type:text/html\r\n\r\n"
print "<html>"
print "<head>"
print "<title>SITE FINDER</title>"
print "</head>"
print "<body>"

print "<h2> Selected pdb1 is %s</h2>" % pdb1
print "</body>"
print "</html>"

the above findsite function is working and giving outputs when run directly on the terminal using python filename.py and generating outputs but it is not running when embedded in cgi script. i have no idea why this is creating problem only when used with cgi script.
Iam using ubuntu 10.10 and apache2 server

Last edited by ashish hasani; 04-03-2012 at 10:14 AM.
 
Old 04-05-2012, 12:18 AM   #2
es0teric
Member
 
Registered: Apr 2007
Distribution: Ubuntu
Posts: 105

Rep: Reputation: 19
Apache limits CGI execution to certain directories, for security reasons. For example, if (on Ubuntu with Apache2) you put a Python script in /var/www/, then Apache will just spit back the code as HTML. If the script is inside of /usb/lib/cgi-bin/, however, it will be executed.

If you want to change which directories are allowed to execute things, there's a config file inside of /etc/apache2/.

Hope that helps.
 
  


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
Cant seem to run any cgi scripts in cgi-bin folder, confused? j.smith1981 Linux - Server 5 02-14-2011 05:38 AM
Python CGI-Bin Scripts chaney44145 Linux - Server 1 01-15-2008 11:44 AM
Displaying JPEG files within the cgi-bin folder metalx1000 Linux - Server 0 12-07-2007 01:22 PM
webprogramming python script in Debian Etch can't find cgi-bin firedancer Linux - Newbie 1 11-18-2007 07:17 AM
why can't create a folder in /usr/lib/cgi-bin adam_ant Linux - Software 2 12-07-2005 05:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:19 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration