Solved

mrtg rrd 14all.cgi apache php? Everything is working except apache php aint displaying CGI scripts!!!!!

Posted on 2003-11-24
4
542 Views
Last Modified: 2013-12-23
hi anyone! how do u get php 4.3 and Apache 2.0.48 to display cgi scripts on FreeBSD 5.1? ive tried everything from Options +ExecCGI in the directories but when i try to get it from the website i get the error server Misconfiguration (ERROR 500!!!). on checking the error logs it says Incomplete ending of script which cant be because when i test the .cgi script it generates the necessary HTML telling me that MRTG and RRD are working but i cant get apache to display on FreeBSD but it has worked on WindowsXP. Can anyone help please!!!!???????????
0
Comment
Question by:KevoZam
  • 2
4 Comments
 
LVL 1

Expert Comment

by:mbekker
ID: 9810718
Hi KevoZam,

Could it be possible that the lines are CR/LF terminated? I see the script is working fine on Windows, but not on Unix. Unix prefers LF terminated lines.

If this is the case you could strip the CarriageReturns from the end of lines with:

1. sed 's/^V^M$//' file.cgi >file2.cgi
2. vi file.cfg
    :%s/^V^M$//
    :wq

The ^ before ^V and ^M means <Ctrl>.

Another way is to FTP the script in ASCII mode from/to Unix/Windows.

Good luck!
0
 
LVL 61

Expert Comment

by:gheist
ID: 9813652
how do you test ???
correct test is:
unset PATH LD_LIBRARY_PATH
export METHOD=GET # and more cgi variables
cd /var/www/cgi-bin
./script.cgi
---
you need this first line for script
#!/usr/bin/perl -w

HTTP prefers <CR><LF> i.e \0x13\0x16 instead of simple \n ( which in Windows case turns into <CR><LF>)

0
 

Author Comment

by:KevoZam
ID: 9829614
thank you Gheist and Mbekker but im kinda new to this could you give me a detailed way to do what your saying?? I test the 14all.cgi script by doing the following in FreeBSD and Windows and the result is the same. The script is called mrtg.cgi so i open a command prompt and get to the cgi-bin where it is saved and say:
                              perl mrtg.cgi
this generates HTML code in the console window telling MRTG and RRD are working. Apache on Windows displayed it but on FreeBSD i get the 500 error and on going to the error log i get message "PREMATURE END OF SCRIPT HEADER". So how do i implement the changes your saying please?????????? Thanks
0
 
LVL 61

Accepted Solution

by:
gheist earned 90 total points
ID: 9830250
I guess your script starts with

print("Content-type: text/html\n\n);

Correct way is
print("Contetnt-type: text/html\012\015\012\015");

no special symbols, all you see is to be typed

i.e.
Windows expands \n in manner you expect, but UNIX and MacOS not
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Join & Write a Comment

What is IRC? IRC (Internet Relay Chat) is a form of communication between multiple users. It is available freely to anyone with inernet access. IRC is a great way to communicate with others e.g. There is an IRC channel for Ubuntu Linux, which is fo…
What’s a web proxy server? A proxy server is a server that goes between clients and web servers, used in corporate to enforce corporate browsing policy and ensure security. Proxy servers are commonly used in three modes. A)    Forward proxy …
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now