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


  Search this Thread
Old 04-03-2012, 11: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

import cgi, cgitb
import os
import sys
form = cgi.FieldStorage()
pdb1 = form.getvalue('pdb')
template1 = form.getvalue('template')
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 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 11:14 AM.
Old 04-05-2012, 01:18 AM   #2
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.


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 06:38 AM
Python CGI-Bin Scripts chaney44145 Linux - Server 1 01-15-2008 12:44 PM
Displaying JPEG files within the cgi-bin folder metalx1000 Linux - Server 0 12-07-2007 02:22 PM
webprogramming python script in Debian Etch can't find cgi-bin firedancer Linux - Newbie 1 11-18-2007 08:17 AM
why can't create a folder in /usr/lib/cgi-bin adam_ant Linux - Software 2 12-07-2005 06:05 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:52 PM.

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