Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 9th, 2001, 10:24 PM
yoey2000 yoey2000 is offline
MMMM...Brains....
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Posts: 461 yoey2000 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 11 h 24 m 57 sec
Reputation Power: 8
Still no luck with cgi-bin..plz help

This is what i put in my httpd.conf :
<VirtualHost 192.168.0.2>
ServerName www.domain.com
ServerAdmin me@domain.com
DocumentRoot /home/httpd/mydomain
ScriptAlias /cgi-bin/ /home/httpd/mydomain/cgi-bin
<Directory "/home/httpd/mydomain/cgi-bin">
Options +ExecCGI
</Directory>
</VirtualHost>

But, when i goto the script, lets say, mydomain.com/cgi-bin/thing.cgi, i get a 404 error message. Help!

Reply With Quote
  #2  
Old June 10th, 2001, 04:39 PM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
Change
ScriptAlias /cgi-bin/ /home/httpd/mydomain/cgi-bin
to
ScriptAlias /cgi-bin /home/httpd/mydomain/cgi-bin
or
ScriptAlias /cgi-bin/ /home/httpd/mydomain/cgi-bin/

(notice how the last slashes have to match on the aliases)

Reply With Quote
  #3  
Old June 10th, 2001, 07:17 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You don't ExecCGI your cgi-bin if it's ScriptAlias'ed.

>> ScriptAlias /cgi-bin /home/httpd/mydomain/cgi-bin

This also incorrect. You don't browse your cgi-bin directory. You access the script directly that resides in it. Just like the
Alias /icons/ "/path/to/icons/".

Reply With Quote
  #4  
Old June 10th, 2001, 07:33 PM
yoey2000 yoey2000 is offline
MMMM...Brains....
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Posts: 461 yoey2000 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 11 h 24 m 57 sec
Reputation Power: 8
so i could either do :

This is what i put in my httpd.conf :
<VirtualHost 192.168.0.2>
ServerName www.domain.com
ServerAdmin me@domain.com
DocumentRoot /home/httpd/mydomain
ScriptAlias /cgi-bin/ /home/httpd/mydomain/cgi-bin/
</VirtualHost>

or

<VirtualHost 192.168.0.2>
ServerName www.domain.com
ServerAdmin me@domain.com
DocumentRoot /home/httpd/mydomain
Alias /cgi-bin/ "/home/httpd/mydomain/cgi-bin/ "
</VirtualHost>

Reply With Quote
  #5  
Old June 11th, 2001, 12:22 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes, but the 2nd one needs ExecCGI because that cgi-bin is not ScriptAlias'ed. If you set ExecCGI for <Directory "/home/httpd/mydomain">, then your cgi-bin, which is just a subdirectory under your docroot would be inherited. Actually, you don't even need Alias /cgi-bin/ "/home/httpd/mydomain/cgi-bin/" because it's under your docroot. You Alias or ScriptAlias only if it's not under your docroot.

Reply With Quote
  #6  
Old June 11th, 2001, 08:18 AM
yoey2000 yoey2000 is offline
MMMM...Brains....
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Posts: 461 yoey2000 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 11 h 24 m 57 sec
Reputation Power: 8
it is under doc root

lets say it is under the docroot. how would i create the cgi-bin then?

Reply With Quote
  #7  
Old June 11th, 2001, 10:24 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Just mkdir.

Reply With Quote
  #8  
Old June 12th, 2001, 05:42 PM
yoey2000 yoey2000 is offline
MMMM...Brains....
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Posts: 461 yoey2000 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 11 h 24 m 57 sec
Reputation Power: 8
?

mkdir?

Reply With Quote
  #9  
Old June 12th, 2001, 10:30 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes, just make a cgi-bin directory under your docroot and set it like so:

ScriptAlias /cgi-bin/ /home/httpd/mydomain/cgi-bin/

However, cgi-bin directory shouldn't be under your docroot for security reasons. You ScriptAlias it so it's possible that your cgi-bin resides in /another/weird/path/to/cgi-bin outside of your docroot.

ScriptAlias /cgi-bin/ /another/weird/path/to/cgi-bin/

The /cgi-bin/ is an absolute URL path: http://www.domain.com/cgi-bin/

cgi-bin by the name itself is NOT a special directory. You just need to mkdir to create it, just like any other directories. What makes it different from others is ScriptAlias so that all files reside in it are treated as CGI script, the scripts still need to be executable with appropriate permission though. That said, you can even set:

ScriptAlias /mycgi-files/ /another/weird/path/to/some/script/directory/

So the URL would look like -> http://www.domain.com/mycgi-files/script.cgi

You can also mkdir /home/httpd/mydomain/cgi-bin/ but do not specify ScriptAlias line to it. Then you need ExecCGI, but it has the same effect as a cgi-bin directory that's ScriptAlias'ed. The difference is, you can run extension-less CGI scripts in a ScriptAlias's cgi-bin.

Reply With Quote
  #10  
Old June 12th, 2001, 10:32 PM
yoey2000 yoey2000 is offline
MMMM...Brains....
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Posts: 461 yoey2000 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 11 h 24 m 57 sec
Reputation Power: 8
yeah

i still get a 404 error, hmmff....................

Reply With Quote
  #11  
Old June 13th, 2001, 12:34 AM
footinmouth footinmouth is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44 footinmouth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Look in error_log

Try reading error_log, sometimes in /var/log/httpd/error_log

A 404 error will be listed with your IP and the path of the 404 file.

Look at this error information and adjust you path to suit.

OR :

Find the error line and post with your virtual section for extra help.

Note 1: Also Apache must be restarted for changes in httpd.conf to be read.

Note 2: by the path's you show you are using Linux ???


Please post again.
__________________
Thanks

Foot in Mouth ver 1.2.5 Onion

Reply With Quote
  #12  
Old June 13th, 2001, 02:35 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> i still get a 404 error

This obviously is not very helpful at all.
Which approach, ScriptAlias or just a plain cgi-bin directory with ExecCGI?
What was the full URL that returned 404 error?

There is one thing I forgot to mention about ScriptAlias. Say you used ScriptAlias /mycgi-files/ "/another/weird/path/to/some/script/directory/"

You also need to specify this:

<Directory "/another/weird/path/to/some/script/directory">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

Since this non-standard path is not under your docroot (/home/httpd/mydomain) nor any path above was already defined, so all the Options and AllowOverride will not be inherited.

Reply With Quote
  #13  
Old June 13th, 2001, 09:57 AM
yoey2000 yoey2000 is offline
MMMM...Brains....
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Posts: 461 yoey2000 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 11 h 24 m 57 sec
Reputation Power: 8
cgi versus perl

i did the "hello world" thing with the extension of .pl....and it worked..woohoo....then i put it to the test of another script. but this script had the .cgi extensions. when i tried to access them through the web browser, it said error 500. i looked at the "add handler" part in my httpd.conf, and i added AddHandler cgi-script .cgi .pl...is there anything else i should do to make the .cgi work?

Reply With Quote
  #14  
Old June 13th, 2001, 06:25 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
That wasn't problem with AddHandler. If .cgi is not being recognized, you would have seen a dialog prompt for download. [500] could be all sort of things.
Please answer this question ( I asked you dozen times without a reply still):

Is your cgi-bin ScriptAlias'ed?

No matter, your script still need execute permission.

Just check your error log and solve the problem yourself. If you can't, post the 1st 5 lines of your script here.

Reply With Quote
  #15  
Old June 13th, 2001, 06:37 PM
yoey2000 yoey2000 is offline
MMMM...Brains....
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Posts: 461 yoey2000 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 11 h 24 m 57 sec
Reputation Power: 8
yes

umm, yes, it is script alias'd. hmm, ok, i will search it.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Still no luck with cgi-bin..plz help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump