LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 04-15-2004, 03:15 PM   #1
ulto
LQ Newbie
 
Registered: Apr 2004
Posts: 20

Rep: Reputation: 0
"Premature end of script headers" bugging me


hi
im running apache on red hat 9 and im trying to run a few scripits through PHP but im getting errors

when i run the script from a browser i get a internal 500 error and the error log tells me that i have "Premature end of script headers"
i presume this is an error regrading the structure of my script so ill post it here

#!/bin/sh


# change: this script read the ip address of the user accessing the web page and matches it with it's MAC address.

#This MAC address is then sent a script called add, which allows it onto the network





read ip_address



IPTABLES=/sbin/iptables



sudo arp > /root/lankfordu/apache/logs/users.txt



sudo awk '{if ($1 == "'"$ip_address"'") print $3}'


/root/lankfordu/apache/logs/users.txt | /root/lankfordu/apache/cgi-bin/add

sudo $IPTABLES -t nat -A POSTROUTING -s $ip_address -j MASQUERADE

when i run the scripts from the command line i get ": bad interpreter: No such file or directory"

so anyideas!!? hope i gave enough info and i have the default test-cgi working so i dont think its anything to do with my httpd.conf file


also what is the best way to call this script from php

at the moment i have echo "'$REMOTE_ADDR' | /root/lankfordu/apache/cgi-bin/change";

but i dont think that will work

cheers
 
Old 04-15-2004, 07:38 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
bad interpreter msg tell that you are missing /bin/sh, which I doubt.
Perhaps is your file using the DOS CR/LF line ending vs unix LF, so the system is looking for /bin/sh^M ...
 
  


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
Premature end of script headers: CGI fatturi Linux - Newbie 4 07-19-2007 05:55 PM
Premature end of script headers bhomass Debian 1 12-02-2005 06:31 PM
Premature end of script headers webhead Red Hat 5 09-22-2004 02:56 AM
Perl/CGI Problem "Premature Premature end of script headers: countdown.pl" newuser455 Linux - Software 2 07-18-2004 12:47 PM
Premature End of Script Headers (Error 500) bsdb3 Red Hat 5 05-06-2004 12:55 PM


All times are GMT -5. The time now is 05:21 PM.

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