LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices

Reply
 
Search this Thread
Old 05-25-2005, 08:41 AM   #1
gani
Member
 
Registered: Jun 2004
Location: Metro Manila, Philippines
Distribution: OpenBSD, Slackware, XP
Posts: 347

Rep: Reputation: 31
Problem excuting cgi script in OpenBSD


Even just the simple Hello, World. cgi script example in Apache tutorial can't be executed within the cgi-bin of OpenBSD. I've followed already the instructions from Apache howto and I keep on getting these errors:

premature end of script header
exec of /cgi-bin/test.pl failed

But executing the script on the command line has no problem.

Any help is greatly appreciated.
 
Old 05-25-2005, 07:42 PM   #2
danielanson
Member
 
Registered: May 2005
Location: San Antonio, TX
Distribution: OpenBSD 3.7
Posts: 76

Rep: Reputation: 15
OpenBSD runs Apache in a chrooted jail hence a perl binary in unavailable for Apache to use unless it is located within the jail. To test the apache configuration,

in the rc.conf file change (TEMPORARILY) the line that reads

httpd_flags="" to httpd_flags="-u"

This allows apache to operate outside of the chrooted jail but is very insecure especially with CGI scripting (a busted script could give somebody ROOT). Now execute >apachectl stop and >apachectl start and follow with a >ps -aux | grep httpd to make sure it is running. Your script should work. Turn the jail back on, and import the perl binary into the Jail.

Best of Luck.
 
Old 05-25-2005, 08:05 PM   #3
danielanson
Member
 
Registered: May 2005
Location: San Antonio, TX
Distribution: OpenBSD 3.7
Posts: 76

Rep: Reputation: 15
Check out this page for a bit more detailed help importing perl. This method works with other binaries as well.

http://home.wplink.net/~yo2lux/tutor...erlchroot.html

DA
 
Old 05-26-2005, 06:40 AM   #4
gani
Member
 
Registered: Jun 2004
Location: Metro Manila, Philippines
Distribution: OpenBSD, Slackware, XP
Posts: 347

Original Poster
Rep: Reputation: 31
Thanks Daniel! It worked! But only for the test.pl I wrote and not for the one that I'm supposed to install, it has two many files to move to chroot jail, so confusing so I just give up.

Thanks again!
 
  


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
OpenBSD Apache and cgi jeempc *BSD 11 11-25-2012 03:48 PM
CGI-script problem on Apache2 jkt2000 Linux - Networking 3 01-28-2005 04:38 AM
virtual hosts and excuting CGI matttail Linux - Newbie 2 08-30-2004 10:04 AM
Apache cgi-script problem palanisaravanan Linux - General 6 02-07-2004 09:41 AM
Apache CGI Problem : Browser not running script Zaknafien Linux - Software 3 12-31-2003 01:16 PM


All times are GMT -5. The time now is 01:04 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration