Unable to run cgi scripts from server.

 
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI
View previous topic :: View next topic  
Author Message
Andy442x
-


Joined: 21 Apr 2004
Posts: 5
Location: UK

PostPosted: Thu Apr 22, 2004 8:15 am    Post subject: Unable to run cgi scripts from server. Reply with quote

I have followed the installation files the best I can, have installed Perl and can run the small test scripts from the command prompt, but I just cant seem to get any scripts working on my server, and get the http 500 error message. It seems the more I read the more confused i'm getting. Any ideas where to go next?
Back to top View user's profile Send private message Yahoo Messenger
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Thu Apr 22, 2004 9:37 am    Post subject: Reply with quote

Have you added the CGI mime type
in your cgi script , just use this!

Code:
print "Content-Type: text/html\";
Back to top View user's profile Send private message Visit poster's website
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Thu Apr 22, 2004 3:54 pm    Post subject: Reply with quote

Try this:
Code:
print "Hello, World!\n" while (1);

_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Andy442x
-


Joined: 21 Apr 2004
Posts: 5
Location: UK

PostPosted: Thu Apr 22, 2004 7:11 pm    Post subject: Reply with quote

(Thankyou both for your swift replies)

OK lets take this back a step....
(I will continue with this post here though I understand that it may be swaying from the 'cgi issues' forum.)
I went off while waiting for a reply and tried to get a php script to work, and got the same 500 message. I will post the file to show you its quite a simple one...

<html>
<body>
<form action=<?php echo $PHP_SELF; ?> METHOD=POST>
Day : <input type=text name=day maxsize=2><br>
Month : <input type=text name=month maxsize=2><br>
Year : <input type=text name=year maxsize=2><br>
<input type=submit value=submit>
<?
if ($day && $month && $year) {
$calc = ($day[0] * $day[1]) + ($month[0] * $month[1]) + ($year[0] * $year[1]);
echo "Your lucky no. is $calc";
}
?>

If I am wrong, and this script will not work with Abyss on my XP home pc can someone please send me a really simple .php file to test.

Can I assume from the fact that php does not work, as well as cgi's, that I have not configured my server correctly?
Back to top View user's profile Send private message Yahoo Messenger
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Thu Apr 22, 2004 7:16 pm    Post subject: Reply with quote

try this , do you see anything

Code:
<?php phpinfo(); ?>
Back to top View user's profile Send private message Visit poster's website
Andy442x
-


Joined: 21 Apr 2004
Posts: 5
Location: UK

PostPosted: Thu Apr 22, 2004 8:36 pm    Post subject: Reply with quote

Yes :D I see the PHP listings !!
Back to top View user's profile Send private message Yahoo Messenger
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Fri Apr 23, 2004 12:21 am    Post subject: Reply with quote

Ok, good. PHP is installed successfully.

That means that the script you are trying to use is misconfigured. Either try to fix it (which may or may not work out well), or use a different script.
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
eznetlinks
-


Joined: 27 Sep 2003
Posts: 144

PostPosted: Fri Apr 23, 2004 1:01 am    Post subject: Reply with quote

Andy442x

The script needs to call for the posted data try this:

<?
ini_set("display_errors", 0);
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
if ($day && $month && $year) {
$calc = ($day[0] * $day[1]) + ($month[0] * $month[1]) + ($year[0] * $year[1]);
echo "Your lucky no. is $calc";
}
?>

also the form tag is misconfigured try this:

<form action=<?php echo $_SERVER["PHP_SELF"]; ?> METHOD=POST>

or just leave action blank:

<form action="" METHOD="POST">
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Apr 23, 2004 3:16 pm    Post subject: Reply with quote

This modified version works for us. Try it:

Code:
<html>
<body>
<form action=<?php echo $PHP_SELF; ?> METHOD=POST>
Day : <input type=text name=day maxsize=2><br>
Month : <input type=text name=month maxsize=2><br>
Year : <input type=text name=year maxsize=2><br>
<input type=submit value=submit>
<?php
$day = $_REQUEST['day'];
$month= $_REQUEST['month'];
$year= $_REQUEST['year'];

if ($day && $month && $year) {
$calc = ($day[0] * $day[1]) + ($month[0] * $month[1]) + ($year[0] * $year[1]);
echo "Your lucky no. is $calc";
}
?>
</body>
</html>

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Andy442x
-


Joined: 21 Apr 2004
Posts: 5
Location: UK

PostPosted: Sat Apr 24, 2004 9:19 pm    Post subject: Reply with quote

Ok I saved the file as index.php and it didn't work.
When i open the file I can see the form boxes but also get the following errors displayed in the browser window:

Notice: Undefined variable: PHP_SELF in C:\Abyss\htdocs\index.php on line 3
METHOD=POST> Day :
Month :
Year :

Notice: Undefined index: day in C:\Abyss\htdocs\index.php on line 9

Notice: Undefined index: month in C:\Abyss\htdocs\index.php on line 10

Notice: Undefined index: year in C:\Abyss\htdocs\index.php on line 11


*** This is copied/pasted exactly as I see it in the IE6 browser (minus the form boxes and submit button ofcourse) **
Any ideas?
Back to top View user's profile Send private message Yahoo Messenger
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Sat Apr 24, 2004 9:37 pm    Post subject: Reply with quote

Those are not errors, those are notices (look at the "Notice:" in every line). If you want PHP to disable displaying notices, search for "E_NOTICE" in these forums.
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
eznetlinks
-


Joined: 27 Sep 2003
Posts: 144

PostPosted: Sun Apr 25, 2004 1:01 am    Post subject: Reply with quote

That is why i added :

ini_set("display_errors", 0);

to the code.
Back to top View user's profile Send private message Visit poster's website
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Sun Apr 25, 2004 1:04 am    Post subject: Reply with quote

But did it work?

He may not be using your code.
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
eznetlinks
-


Joined: 27 Sep 2003
Posts: 144

PostPosted: Sun Apr 25, 2004 1:33 am    Post subject: Reply with quote

iNaNimAtE

Yes it did.
That's how i know apreliums code is being used.
Back to top View user's profile Send private message Visit poster's website
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Sun Apr 25, 2004 1:47 am    Post subject: Reply with quote

Ok, to make it easy:
Code:
<html>
<body>
<form action=<?php echo $PHP_SELF; ?> METHOD=POST>
Day : <input type=text name=day maxsize=2><br>
Month : <input type=text name=month maxsize=2><br>
Year : <input type=text name=year maxsize=2><br>
<input type=submit value=submit>
<?php
ini_set("display_errors", 0);
$day = $_REQUEST['day'];
$month= $_REQUEST['month'];
$year= $_REQUEST['year'];

if ($day && $month && $year) {
$calc = ($day[0] * $day[1]) + ($month[0] * $month[1]) + ($year[0] * $year[1]);
echo "Your lucky no. is $calc";
}
?>
</body>
</html>

There's the revised code.

If you don't feel like using that, uncomment the E_NOTICE line in your php.ini file.
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
eznetlinks
-


Joined: 27 Sep 2003
Posts: 144

PostPosted: Sun Apr 25, 2004 2:02 am    Post subject: Reply with quote

There Ya GO!

K.I.S.S.
Back to top View user's profile Send private message Visit poster's website
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Sun Apr 25, 2004 2:52 am    Post subject: Reply with quote

As in "Keep It Simple, Stupid?"

I'm not exactly doing it for my benefit. That last post was for Andy442x to copy right off the forum and paste it into a file.
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Andy442x
-


Joined: 21 Apr 2004
Posts: 5
Location: UK

PostPosted: Sun Apr 25, 2004 8:53 pm    Post subject: Reply with quote

OK I have disabled display notices and have successfully installed and run a good few php scripts now.

In hindsight maybe I should have read up a bit more on php, but after installing a new server, re-doing a ton of html, and trying to get a forum installed my brain had gone into melt-down with information overload.

I haven't had time to try installing any more cgi scripts to see if I can cure that, but after the php issue I am going to have another go and see if I can get it working.

I have only been using Abyss for a short time and I am very impressed with what I see. What impresses me most is this forum. I have posted a genuine question and it has been answered in a kind and curtious manner, even when it is fairly obvious that the poster is a bit of a newb at server running (especially php and cgi configs.) I have been given an array of useful answers and solutions to my question for which I am very grateful.

Thanks, and keep up the good work....


*Turns kiss-ass mode OFF* ;)
Back to top View user's profile Send private message Yahoo Messenger
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Sun Apr 25, 2004 9:16 pm    Post subject: Reply with quote

Haha... no problem.
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group