Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Alternative Computing > Linux Support
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Linux Support Linux - Operating Systems and Applications Support

Reply
 
LinkBack Thread Tools
Old 10-06-2009, 08:07 AM   #1 (permalink)
Registered User
 
Join Date: Sep 2009
Posts: 16
OS: Ubuntu Server 9.04


[SOLVED] Trying to install cgi on Ubuntu Server 9.04

Hello everyone,
I am using Ubuntu Server 9.04 command line version. I have Apache installed and it is working (I am getting the webpage with the words “It Works” on it). I also have PHP5 installed and it is also working (I am getting the webpage that gives all of the information about PHP).

Now this is where the problem arise…CGI. I do not know how to get this CGI stuff installed.

Was CGI installed when PHP or Perl or Apache was installed??
Are these instructions correct??
What is the site configuration file??
What does it mean by <Virtual Host> tags??
I’ve seen some different things as far as the file permissions and making the file executable.
Should I use chmod a+x or chmod 755 or chmod +x??

These are the instructions that I am using. They are located on this website:
http://www.ubuntugeek.com/how-to-ins...tu-server.html

Enable CGI and perl support for apache2 server

You need to install the following package

sudo aptitude install libapache2-mod-perl2

Configure a cgi-bin directory

You need to create a cgi-bin directory using the following command

sudo mkdir /home/www/cgi-bin

Configuring Apache to allow CGI program execution is pretty easy. Create a directory to be used for CGI programs and add the following to the site configuration file (again between the <VirtualHost> tags).

ScriptAlias /cgi-bin/ /home/www/cgi-bin/

<Directory /home/www/cgi-bin/>
Options ExecCGI
AddHandler cgi-script cgi pl
</Directory>

The first line creates an alias that points to the directory in which CGI scripts are stored. The final line tells Apache that only files that end with the *.cgi and *.pl extensions should be considered CGI programs and executed.

Test your Perl Program
cd /home/www/cgi-bin

sudo nano perltest.pl

Copy and paste the following section save and exit the file.

###Start###
#!/usr/bin/perl -w
print "Content-type: text/html\r\n\r\n";
print "Hello there!<br />\nJust testing .<br />\n";
for ($i=0; $i<10; $i++)
{
praint $i."<br />";
}
###End###
make sure you change permissions on it
sudo chmod a+x perltest.pl
Now open your web browser open http://yourserverip/cgi-bin/perltest.pl.It should be working.
lcsfsr1 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 10-07-2009, 06:52 PM   #2 (permalink)
Registered User
 
Join Date: Oct 2009
Posts: 19
OS: Windows XP SP3, Windows 2000 SP4, Mac OS X 10.5.8, Mac OS X 10.6.1, Various Linux Distros


Re: Trying to install cgi on Ubuntu Server 9.04

The instructions make sense. Try them and report back on what happens.
sultanqasim is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-07-2009, 11:11 PM   #3 (permalink)
Registered User
 
Join Date: Sep 2009
Posts: 16
OS: Ubuntu Server 9.04


Re: Trying to install cgi on Ubuntu Server 9.04

Ok,
First, I created a cgi-bin folder in this location:
/home/www/cgi-bin

It has a sample perl test script in the cgi-bin folder.

Now, I have found the Site Configuration File (with the <VirtualHost> and </VirtualHost> tags. It is located in this directory:

/etc/apache2/sites-available/default

I have entered the required information between the 2 tags.

This Site Configuration File now looks like this:

<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

ScriptAlias /cgi-bin/ /home/www/cgi-bin

<Directory /home/www/cgi-bin/>
Options ExecCGI
AddHandler cgi-script cgi pl
</Directory>

</VirtualHost>


I then changed the permissions on the file as stated. I even rebooted the computer.

Now when I got to http://192.168.0.9/cgi-bin/perltest.pl

I get the following error:

It is an HTTP Error 404

The webpage cannot be found
HTTP 404
Most likely causes:
There might be a typing error in the address.
If you clicked on a link, it may be out of date.

What you can try:
Retype the address.

Go back to the previous page.

Go to and look for the information you want.

More information


Any ideas????

Thanks for the help!

Bobby
lcsfsr1 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-08-2009, 02:20 PM   #4 (permalink)
Registered User
 
Join Date: Oct 2009
Posts: 19
OS: Windows XP SP3, Windows 2000 SP4, Mac OS X 10.5.8, Mac OS X 10.6.1, Various Linux Distros


Re: Trying to install cgi on Ubuntu Server 9.04

Open the cgi-bin direcory and run "chmod a+rx perltest.pl", and try again. If that doesn't work, put an html page in the cgi-bin folder and call it test.html
Try going to http://192.168.0.9/cgi-bin/test.html

What does your browser say? 404 errors are usually errors with the apache server or permissions.

Last edited by sultanqasim; 10-08-2009 at 02:24 PM.
sultanqasim is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-19-2009, 02:46 PM   #5 (permalink)
Registered User
 
Join Date: Sep 2009
Posts: 16
OS: Ubuntu Server 9.04


Re: Trying to install cgi on Ubuntu Server 9.04

ok, well to let everyone know...the problem was:
after i went into the site configuration file, i went to the bottom of the file and created a new area...
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">

</Directory>

This was apparently the problem because when i went and deleted this new area, that i created, I combined the my information into the existing ScriprtAlias area. then i went through and did everything again...this time it worked. i am able to successfully run and use perl scripts.

Thank you very much for your help!!!

Bobby Howerton
lcsfsr1 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-22-2009, 09:57 AM   #6 (permalink)
Registered User
 
Join Date: Sep 2009
Posts: 16
OS: Ubuntu Server 9.04


Re: Trying to install cgi on Ubuntu Server 9.04

This problem has be SOLVED.
lcsfsr1 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 05:36 AM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85