Help - Search - Members - Calendar
Full Version: How do I enable CGI Scripting?
The Planet Forums > Control Panels > Plesk
jaxon121
Just running a single server and a single web site. I want to enable cgi scripting on the site/server. How do I do this?
meballard
In your httpd.conf file, there are usually two Options lines, put ExecCGI in both of them, and it should work.
jaxon121
where is that file usually located?
meballard
It's normally in /etc/httpd/conf/
You can do a:
find / -name httpd.conf
if it isn't.
Rich2k
In a plesk box it's located in /usr/local/psa/apache/conf/
jaxon121
Thanks to both of you for responding... your posts have helped me out tremendously. Please bear with me for more stupid questions. This is an excerpt from the httpd.conf file:

# Each directory to which Apache has access, can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# permissions.
#

Options FollowSymLinks
AllowOverride None



#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#


#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
Options Indexes FollowSymLinks MultiViews

-------------------

So if I understand meballard correctly, all I have to do is add ExecCGI to both Options lines, right? So it would go like this:


Options FollowSymLinks ExecCGI
AllowOverride None


Options Indexes FollowSymLinks MultiViews ExecCGI


Thanks once again for your help!
meballard
Yes, that should allow CGI scripts to run on the whole site (of course assuming the permissions are set properly).
jaxon121
Oh great.... where do I set the permissions? Is that done using the Plesk interface?
meballard
Permissions are most commonly set using FTP when you upload the file (the main thing is that Execute must be enabled for all groups), it can also be done using a shell prompt.
jaxon121
Okay, problem.... I'm using telnet to login to the server. (You guys have told me that telnet sucks for security reasons, but I don't know a thing about SSH!) I tried editing the httpd.conf file using pico, but it won't let me save the changes! "Cannot open file for writing: Permission denied"

I used the admin login .... how the heck do i allow myself to write to files?

Re: permissions ... can that be done with most FTP clients? I can't figure out how to do it with my client (FTPExplorer, an oldie but goodie). How would I do it with a shell prompt instead?
meballard
After you login using the admin account, type su and when it asks for your password, enter the same one. Once you've done that, you're logged in as root, and then you can do anything you want.

SSH, in it's basic form, is very much like telnet, do a search and you kind find a couple of free ones, a fairly good free one is putty.

To set permissions at a prompt for a CGI script, the easiest is this command:
chmod 755 file
755 tells it to do read all, execute all, write only for owner (that's not how the numbers work, but for more on that read the man page or do a search).
jaxon121
Great!! I'm almost there!! Just one more question (I think):

On a Plesk box, where the heck are all the files for my site? What's the usual root directory if I only have one site on the box?
meballard
I'm not entirely sure for Plesk, I know the base standard for Apache is /var/www, but it's probably different for Plesk, I'm sure someone else knows, but you can do a:
find / -name filename
for a file or directory on your website and see where that shows for the location.
Rich2k
There are a number of different locations

Your standard domain sites are located at:
/usr/local/psa/home/vhosts/domain.com (with your web pages in public_html off that)

Your default site (when you go to an IP address with only name based hosting on):
/usr/loca/psa/home/vhosts/default

Webmail (I think it's here... without checking)
/usr/local/psa/home/vhosts/webmail

Template configuration for new domain sites
/usr/local/psa/home/vhosts/.skel

Plesk Admin site I won't bother with seeing as all the PHP files are Zend encoded.
jaxon121
Thanks all, I found the directory with the search.... did the
chmod 755
thing... but apparently, it still isn't working. I've been told that there is a way to enable CGI scripting for the entire site/server/directory globally (as opposed to setting permissions on each individual file). How is this done?

Rich2k, that last comment was all Greek to this newbie ... translation? icon_biggrin.gif :confused:
meballard
For CGI files, permissions always have to be set for each file. Try checking the error log for your site and see if you see the error in there (look for the error_log file).
jaxon121
These are the errors I got:

[Mon Mar 11 03:18:38 2002] [error] [client xx.xx.xxx.xx] script not found or unable to stat: /usr/local/psa/apache/cgi-bin/ccbill-local.cgi

[Mon Mar 11 03:24:10 2002] [error] [client xx.xx.xxx.xx] script not found or unable to stat: /usr/local/psa/apache/cgi-bin/whereami.cgi

[Mon Mar 11 03:25:02 2002] [error] [client xx.xx.xxx.xx] Premature end of script headers: /usr/local/psa/home/vhosts/streetdreamsx.com/httpdocs/ccbill/whereami.cgi

The guy I talked to said that 1) the cgi-bin directory is not visible from the web, so I have to change that.. and 2) there is a way to enable cgi scripts globally on the site, and that I need to do that as well.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.