cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie CGI Help

mooer
Dabbler
Posts: 19
Registered: 21-08-2008

Newbie CGI Help

I am attempting to upload some cgi scripts to my cgi webspace.  I have ftp-ed in fine and uploaded my files, set the permissions but am unable to view the files at http://ccgi.porchfield.free-online.co.uk/list-admin.cgi which returns a 500 server error. 
What have I done wrong?Huh
Amanda
24 REPLIES
snozboz
Grafter
Posts: 384
Thanks: 2
Registered: 27-07-2007

Re: Newbie CGI Help

Please can you provide more information.  For instance, can you point us to somewhere we can read the code in your "list-admin.cgi" file?  Or at least tell us what language it uses (e.g. PHP or Perl) and what version of the language it requires.  And also what that file is trying to do, and what other files etc. you've got in your ccgi webspace - I notice you get the same error from the root of your ccgi webspace.
Community Veteran
Posts: 14,469
Registered: 30-07-2007

Re: Newbie CGI Help

What permissions have you set? Is this something your have written or is it something you have downloaded and thus should work?
A 500 error is usually permissions wrong or a syntax error in the script.
mooer
Dabbler
Posts: 19
Registered: 21-08-2008

Re: Newbie CGI Help

Hi,
This is something I have downloaded (AWT Subscribe! 1.0 ) - there is a html file in there called sample.html which I can't go to either... I still get 500 server error.  I have set permission as per the CGI FAQ (files are all 700 and directory is 750).  Help!!
Community Veteran
Posts: 767
Registered: 29-10-2008

Re: Newbie CGI Help

Guessing: is there a .htaccess file in there? (May need to tell your ftp client to show hidden files.) If there is, and you rename it off.htaccess, can you now see the sample.html? If you can, the .htaccess may need editing down a bit. If you post the contents, someone here can suggest how to do that.
Gabe
mooer
Dabbler
Posts: 19
Registered: 21-08-2008

Re: Newbie CGI Help

Hi,
No, there is no .htaccess in there. I am using Filezilla and enabled "Always show hidden files".
Amanda
Superuser
Superuser
Posts: 9,037
Thanks: 488
Fixes: 43
Registered: 06-04-2007

Re: Newbie CGI Help

The files are actually Perl so need a .pl extension rather than .cgi. Permissions 0700 should work for these. The sample.html file should have permissions 0640 and displays OK on my ccgi space. I'd be wary of entering anything in this form for reasons explained in the next paragraph.
Take care: from a quick look at the files, email addresses appear to be stored in a plain text file which could easily be accessed by a spammer to harvest email addresses. Without very detailed analysis of operation of the programs I'd be wary of implementing this. It wouldn't be fair for any subscriber.
Concerning the server 500 errors: Do any of your files or folders have write permission for anyone other than the owner (you)? That is nothing is x77, x70, x66 or x60?
If you create the following PHP file (as php_info,php)
[code=php_info.php]
<?php
phpinfo();
?>[/code]
upload it to the root of your ccgi space, change permissions to 0700 then browse to it, does it list the PHP environment?
David
David
Community Veteran
Posts: 767
Registered: 29-10-2008

Re: Newbie CGI Help

The .cgi extension will work for perl scripts - the shebang line identifies the interpreter.
I doubt if it's a rogue write permission, as we're getting 500 errors off randomfilename.html, rather than 404. That would be consistent with a duff .htaccess but not a script error. Perhaps start by trying to get a .html file returned. If you reload the sample.html file as ascii, can you see it?
Gabe
mooer
Dabbler
Posts: 19
Registered: 21-08-2008

Re: Newbie CGI Help

Hi,
I have created a file http://ccgi.porchfield.free-online.co.uk/php_info.php which I get the same 500 Server error.  I also tried reloading sample.html as ASCII but no joy - same error!!
Amanda
Community Veteran
Posts: 14,469
Registered: 30-07-2007

Re: Newbie CGI Help

Can you post exactly what you have in the php_info.php file.
If this is as detailed earlier I suspect your ccgi webspace has not been configured properly by PN when it was enabled. You need to raise a ticket and get PN to check the set-up of your ccgi webspace.
Superuser
Superuser
Posts: 9,037
Thanks: 488
Fixes: 43
Registered: 06-04-2007

Re: Newbie CGI Help

Yes, this does look like a cgi space configuration error.
Does FileZilla show files and directories have your username as owner and cgiusers as group? If you don't have any subdirectories create one (eg called test) so you can see ownership information.
David
mooer
Dabbler
Posts: 19
Registered: 21-08-2008

Re: Newbie CGI Help

Hi,
The php file content is as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Welcome</title>
</head>
<body>
<?php
phpinfo();
?>
</body>
</html>

Sorry spraxyt, I'm not totally certain what you mean?  I have one subdirectory called stat which has permissions of 750.
Amanda
Community Veteran
Posts: 14,469
Registered: 30-07-2007

Re: Newbie CGI Help

What ftp client are you using... a graphical one or dos/linux command line?
You need to view the files and directories as a list which will show the owner and group names as well as file permissions.
Normally it will show as size permissions owner group date filename
It is the owner and group we are after.
Community Veteran
Posts: 767
Registered: 29-10-2008

Re: Newbie CGI Help

David's suggesting looking at the ownership. If you look in the list view to the right of permissions is owner/group, which should say porchfield cgiusers next to each file and folder.
The thought is that the server error has to arise before the web server even knows it has a file to serve. If there's no .htaccess to get in the way then it looks v much like a malconfiguration - PN's fault, not yours.
Gabe
PS - crossed in post with Peter
mooer
Dabbler
Posts: 19
Registered: 21-08-2008

Re: Newbie CGI Help

Hi,
I am using Filezilla.  I have enabled the Owner/group column and it shows porchfield/cgiusers for all files in there.  I have raised a ticket with Support.  Many thanks for all your help thus far.
Amanda