Thanks for that David. I reviewed the reference and understand setting the permissions and the reasons why.
I have managed now to establish the following and would like further help.
I have checked that my httpd.conf is loading the cgi module.
For the following test script: -
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html><head>\n";
print "<title>hello world test</title></head>\n";
print "<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#FF0000\" vlink=\"#800000\">\n";
print "<h1>hello world!</h1>\n";
print "</body></html>\n";
I get this exact message from the error log: -
[Thu Apr 15 10:28:28 2004] [error] [client 192.168.0.12] Premature end of script headers: helloworld.pl, referer:
http://192.168.0.31/index.php
Here are my environment settings: -
BASH=/bin/bash
BASH_ENV=/root/.bashrc
BASH_VERSINFO=([0]="2" [1]="05b" [2]="0" [3]="1" [4]="release" [5]="i386-redhat-linux-gnu")
BASH_VERSION='2.05b.0(1)-release'
COLORS=/etc/DIR_COLORS.xterm
COLORTERM=gnome-terminal
COLUMNS=80
DIRSTACK=()
DISPLAY=:0.0
EUID=0
GDMSESSION=Default
GNOME_DESKTOP_SESSION_ID=Default
GROUPS=()
GTK_RC_FILES=/etc/gtk/gtkrc:/root/.gtkrc-1.2-gnome2
G_BROKEN_FILENAMES=1
HISTFILE=/root/.bash_history
HISTFILESIZE=1000
HISTSIZE=1000
HOME=/root
HOSTNAME=development
HOSTTYPE=i386
IFS=$' \t\n'
INPUTRC=/etc/inputrc
LANG=en_GB.UTF-8
LESSOPEN='|/usr/bin/lesspipe.sh %s'
LINES=24
LOGNAME=root
LS_COLORS='no=00:----etc --- tif=00;35:'
MACHTYPE=i386-redhat-linux-gnu
MAIL=/var/spool/mail/root
MAILCHECK=60
OLDPWD=/var/www
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
PIPESTATUS=([0]="0")
PPID=2488
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
PS1='[\u@\h \W]\$ '
PS2='> '
PS4='+ '
PWD=/var/www/cgi-bin
QTDIR=/usr/lib/qt-3.1
SESSION_MANAGER=local/development:/tmp/.ICE-unix/1949
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
SHLVL=2
SSH_AGENT_PID=2007
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SSH_AUTH_SOCK=/tmp/ssh-XXqPl0Ev/agent.1949
SUPPORTED=en_GB.UTF-8:en_GB:en
TERM=xterm
UID=0
USER=root
USERNAME=root
WINDOWID=46137608
XAUTHORITY=/root/.Xauthority
XMODIFIERS=@im=none
_=
i=/etc/profile.d/which-2.sh
The error code does not change if I comment the #!/usr/bin/perl line out!!!
So this says to me that the script is found but not even opening. Here is the listing of the directory permissions and its contents: -
in /
drwxr-xr-x 22 root root 4096 Apr 15 10:43 var
in/var
drwxr-xr-x 19 root root 4096 Apr 15 10:40 www
in/var/www
drwxr-xr-x 2 root root 4096 Apr 15 10:39 cgi-bin
in /var/www/cgi-bin
-rwxr-xr-x 1 apache apache 385 Apr 14 14:00 helloworld.pl
I still cannot see what is wrong and am confused since I can run a simple perl file.pl test and get command line output irrespective of whether I state /usr/bin/perl file.pl or without the path.
Anything you can spot please?
Thanks in advance