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

Notices


Reply
  Search this Thread
Old 06-11-2009, 12:56 AM   #1
snucky
LQ Newbie
 
Registered: Jun 2009
Posts: 18

Rep: Reputation: 0
shell scripts (cgi) via apache ends in 500


The simplest of all CGI scripts won't execute! It should run under Apache 1.3 with FastCGI and suEXEC (and mod_ssl). I get Apache 500 error for http://snucky.com/cgi-bin/hello-world.cgi

the suEXEC log keeps adding a row for each call:
info: (target/actual) uid: (snucky/snucky) gid: (reimann/reimann) cmd: hello-world.cgi

Code:
ls -l /home/snucky/cgi-bin/hello-world.cgi
-rwxr-xr-x 1 snucky reimann 72 2009-06-10 21:41 /home/snucky/cgi-bin/hello-world.cgi
/usr/local/apache/conf/httpd.conf
Code:
User webuser
Group webgroup

Listen *:80

AddHandler php5-fastcgi .php
Action php5-fastcgi /cgi-bin/php.fcgi
AddHandler cgi-script cgi pl

<VirtualHost 192.168.1.41:80>
	ServerName snucky.com
	ScriptAlias /cgi-bin "/home/snucky/cgi-bin"

	User snucky
	Group reimann
	
	DocumentRoot /home/snucky/public_html

	ErrorLog logs/snucky.com-error_log
	CustomLog logs/snucky.com-access_log common
	<Directory "/home/snucky/public_html">
		Options -Indexes FollowSymLinks +ExecCGI
		AllowOverride All
		Order allow,deny
		Allow from all
	</Directory>
	<Directory "/home/snucky/cgi-bin">
		AllowOverride All
		Options +ExecCGI
	</Directory>
</VirtualHost>
how apache is configured:
Code:
SSL_BASE="/usr/local/ssl" \
./configure \
"--with-layout=Apache" \
"--enable-module=unique_id" \
"--enable-module=rewrite" \
"--enable-module=speling" \
"--enable-module=info" \
"--enable-module=userdir" \
"--enable-module=so" \
"--enable-module=ssl" \
"--activate-module=src/modules/fastcgi/libfastcgi.a" \
"--prefix=/usr/local/apache" \
"--enable-suexec" \
"--suexec-caller=webuser" \
"--suexec-docroot=/home" \
"--enable-module=cgi" \
the silly script lastly:
Code:
#!/bin/bash
echo "Content-type: text/html\r\n\r\n"
echo "Hello, World!"
 
Old 06-11-2009, 03:07 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,889

Rep: Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608Reputation: 1608
Hi,

You need an empty line after "Content type" and not the "\r\n\r\n". So you have to edit your script like this:
Code:
#!/bin/bash
echo "Content-type: text/html"
echo
echo "Hello, World!"
Regards
 
Old 06-12-2009, 10:48 AM   #3
snucky
LQ Newbie
 
Registered: Jun 2009
Posts: 18

Original Poster
Rep: Reputation: 0
doh! And I look and shift around and look ... in the wrong place
Emarrassing
 
  


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
CGI scripts - Persistent Server 500 errors DLHOMME Linux - Networking 9 05-22-2006 03:56 PM
CGI scripts - Persistent Server 500 errors DLHOMME Linux - Networking 1 05-19-2006 08:56 AM
RH 8.0 CGI 500 error (apache) 3Dxx Linux - General 46 06-27-2005 06:51 AM
Apache & CGI error 500 sortia Linux - Newbie 2 01-24-2005 12:38 PM
how to execute shell scripts from cgi script rajatgarg Linux - General 1 07-08-2004 02:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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

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