PDA

View Full Version : Newbie help with scripting


Natog
02-16-2006, 07:30 PM
Great forum, thanks!

I am trying to run a small script which reports my IP address (good for dynamic IP broadband). I am using Gateway IP Monitor to view this script and email the IP address. Program link here:

http://www.netikus.net/software/gatewayipmonitor/index.html

My problem is I cannot get a script to run, either .pl, .php, or .asp. The error I get is

"500 Server Error
A misconfiguration on the server caused a hiccup. Check the server logs, fix the problem, then try again. URL: http://www.leben.com/~mitch/gatewayipmonitor/showip.php"

The control panel error logs show:

[Thu Feb 16 20:24:33 2006] [error] [client 69.22.17.215] getpwnam: invalid username mitch [Thu Feb 16 20:24:33 2006] [error] exec of /home/lebencom/public_html/~mitch/gatewayipmonitor/showip.php failed [Thu Feb 16 20:24:33 2006] [error] [client 69.22.17.215] Premature end of script headers: /home/lebencom/public_html/~mitch/gatewayipmonitor/showip.php

Here is the actual script. I sent it to a friend of mine and it works on his web server. BTW I set permissions on the file to 755.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>test</title>
</head>


<?php
print $HTTP_SERVER_VARS["REMOTE_ADDR"];
?>

</body>
</html>

macgyver2
02-16-2006, 07:36 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>test</title>
</head>


<?php
print $HTTP_SERVER_VARS["REMOTE_ADDR"];
?>

</body>
</html>

You have a </body> but not a <body>!

Natog
02-16-2006, 08:15 PM
You have a </body> but not a <body>!

At least I'm not loosing my head!

I changed it as follows, still getting the same error. Is there anything I have to DO to enable scripts to work?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<body>
<html>
<head>
<title>test</title>
</head>


<?php
print $HTTP_SERVER_VARS["REMOTE_ADDR"];
?>

</body>
</html>

2notch
02-16-2006, 08:45 PM
<body> has to go right after </head>.

Natog
02-16-2006, 09:20 PM
<body> has to go right after </head>.

Thought that would do it, but still the same error:

[Thu Feb 16 22:15:23 2006] [error] [client 69.22.17.215] getpwnam: invalid username mitch [Thu Feb 16 22:15:23 2006] [error] exec of /home/lebencom/public_html/~mitch/gatewayipmonitor/showip.php failed [Thu Feb 16 22:15:23 2006] [error] [client 69.22.17.215] Premature end of script headers: /home/lebencom/public_html/~mitch/gatewayipmonitor/showip.php

Here is the revised script:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>test</title>
</head>
<body>


<?php
print $HTTP_SERVER_VARS["REMOTE_ADDR"];
?>

</body>
</html>

Natog
02-16-2006, 09:27 PM
OK, it works! Same script, but I moved it into the /public_html/cgi-bin/ directory on my account.

Andy
02-17-2006, 01:45 AM
yes, some webhosts only allow you to run php in the cgi-bin. pretty sad

macgyver2
02-17-2006, 05:27 AM
yes, some webhosts only allow you to run php in the cgi-bin. pretty sad
I'm not a php person, and that's probably why I don't understand why it's 'pretty sad'. In general, however, I've always heard that it's slighty better, security-wise, to only allow scripts to be run from one place (and usually that place is cgi-bin). Why does this guideline differ for php?

solarnexus
02-17-2006, 12:47 PM
I'm not a php person, and that's probably why I don't understand why it's 'pretty sad'. In general, however, I've always heard that it's slighty better, security-wise, to only allow scripts to be run from one place (and usually that place is cgi-bin). Why does this guideline differ for php?
CGI is generally less secure than other means. the CGI version of PHP has some rather serious security issues, which I'll not get into here, but you can do a search for yourself.

hosam119
08-15-2007, 10:36 PM
thank you all

برامج (http://www.new7ob.com)
صور (http://www.new7ob.com/vb)