Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2003-11-24
4
Medium Priority
?
558 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 62

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 62

Accepted Solution

by:
gheist earned 360 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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

715 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