cancel
Showing results for 
Search instead for 
Did you mean: 

CGI Noob Question

cpcnw
Rising Star
Posts: 66
Thanks: 6
Fixes: 1
Registered: ‎10-08-2007

CGI Noob Question

Hi can anyone give me some pointers / steps to get a script running on the new ccgi space?
Things like ;
Where to store the scripts [/public/CGI-BIN or /cgi-bin?]
How to reference the scripts
Path to Perl
Do I need a .htaccess
Etc
TIA!
7 REPLIES 7
bobpullen
Community Gaffer
Community Gaffer
Posts: 14,895
Thanks: 2,498
Fixes: 168
Registered: ‎04-04-2007

Re: CGI Noob Question

Hi,
Quote from: cpcnw
Where to store the scripts [/public/CGI-BIN or /cgi-bin?]

Unless, you've made any changes, attempts to access /cgi-bin via a  web browser will be re-written to /public/CGI-BIN. It doesn't sound like you're making use of your space so what I'd suggest you do is delete the /public/CGI-BIN directory along with the .htaccess file you should find in your root directory. This will remove the rewrite mentioned above and leave you with a clean slate where perl, cgi scripts reside under /cgi-bin and PHP files under /public.
Quote from: cpcnw
How to reference the scripts

After following the above instructions a file called script.pl in /cgi-bin would be publicly accessible using http://ccgi.username.plus.com/cgi-bin/script.pl
A PHP file called script.php in the public folder would be publicly accessible using http://ccgi.username.plus.com/script.php
Quote from: cpcnw
Path to Perl

I believe /usr/bin/perl will do the trick.
Quote from: cpcnw
Do I need a .htaccess

Depends what you're trying to do.
There's a bit more info in the migration FAQ's here.

Bob Pullen
Plusnet Product Team
If I've been helpful then please give thanks ⤵

cpcnw
Rising Star
Posts: 66
Thanks: 6
Fixes: 1
Registered: ‎10-08-2007

Re: CGI Noob Question

> delete the /public/CGI-BIN directory along with the .htaccess file you should find in your root directory
Done this using the CP Filemanager
> a file called script.pl in /cgi-bin would be publicly accessible using http://ccgi.username.plus.com/cgi-bin/script.pl
Mmm, not working...
---
40 Not Found
The requested URL /CGI-BIN/forum.pl was not found on this server.
---
> I believe /usr/bin/perl will do the trick.
#!/usr/bin/perl
This is what I have at top of my forum.pl and its chmod 700

bobpullen
Community Gaffer
Community Gaffer
Posts: 14,895
Thanks: 2,498
Fixes: 168
Registered: ‎04-04-2007

Re: CGI Noob Question

Quote from: cpcnw
---
40 Not Found
The requested URL /CGI-BIN/forum.pl was not found on this server.
---

Sounds to me like you've not removed/renamed the .htaccess file in the root?

Bob Pullen
Plusnet Product Team
If I've been helpful then please give thanks ⤵

cpcnw
Rising Star
Posts: 66
Thanks: 6
Fixes: 1
Registered: ‎10-08-2007

Re: CGI Noob Question

I know its odd - checked with FileZilla and the CP Filemanager ?
cpcnw
Rising Star
Posts: 66
Thanks: 6
Fixes: 1
Registered: ‎10-08-2007

Re: CGI Noob Question

If I re-establish CGI-BIN under public
and put the script files in the /public/CGI-BIN folder and then reference the script at http://ccgi.custompc.plus.com/CGI-BIN/forum.pl
I get the text content of the script...
bobpullen
Community Gaffer
Community Gaffer
Posts: 14,895
Thanks: 2,498
Fixes: 168
Registered: ‎04-04-2007

Re: CGI Noob Question

I'm guessing you've not got Filezilla configured to display hidden files. I've renamed the .htaccess file for you and it works now.

Bob Pullen
Plusnet Product Team
If I've been helpful then please give thanks ⤵

cpcnw
Rising Star
Posts: 66
Thanks: 6
Fixes: 1
Registered: ‎10-08-2007

Re: CGI Noob Question

Hey Bob - my FileZilla is indeed set to show hidden.
In fact I tested it by copying a .htaccess elsewhere and it was visible
Seems odd?
Anyways - thanks for looking at it!