LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 02:15 PM   #1
ulto
Member
 
Registered: Apr 2004
Posts: 52

Rep: Reputation: 1
"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, 06:38 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:57 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
Open Source Consulting | Domain Registration