Perl path?

Discussion about BCA's Internet Hosting Service

Perl path?

Postby David Cooke » Tue 21 Dec 2010 10:38

The CCCC Webmaster wrote:Hi,

I was wanting to add some perl scripts to our "thecccc" page. I've looked though the documentation I could find, but I didn't manage to find the perl path for the server. Could you let me know what it is?

Thanks,
Christine
Dave Cooke
BCA Web Services, Hidden Earth Treasurer, National Cave Registry Co-ordinator, CSCC Webmaster
David Cooke
Site Admin
 
Posts: 226
Joined: Thu 29 Dec 2005 23:22
Location: Axbridge, Somerset, UK

Postby David Cooke » Tue 21 Dec 2010 10:39

Hi Christine,

it is /usr/bin/perl

However, I created a quick perl script to check all is OK and it failed!

I could easily have overlooked something OR there is a problem with the
server's support for perl.

I think it is unlikely you're the first site to use perl, however if you continue
to get un-explained problems let me know and I'll investigate more.
Dave Cooke
BCA Web Services, Hidden Earth Treasurer, National Cave Registry Co-ordinator, CSCC Webmaster
David Cooke
Site Admin
 
Posts: 226
Joined: Thu 29 Dec 2005 23:22
Location: Axbridge, Somerset, UK

Postby David Cooke » Wed 22 Dec 2010 19:26

Perl works fine. I spent a little more time and spotted a permission error I had made. :oops:

I found a useful guide to getting your first Perl script to run. See Running 'Hello World' as a CGI Script
Dave Cooke
BCA Web Services, Hidden Earth Treasurer, National Cave Registry Co-ordinator, CSCC Webmaster
David Cooke
Site Admin
 
Posts: 226
Joined: Thu 29 Dec 2005 23:22
Location: Axbridge, Somerset, UK

Postby cdonica » Wed 20 Jul 2011 12:34

Thanks David, it worked :)

Now I've got another (related) issue. When I run a perl script, how can I find files in our thecccc.org.uk space? The perl script seems to actually execute in /usr/bin/perl, and I can't find my way back to a text file that's in the space we control.

Thanks,
Christine
cdonica
 
Posts: 5
Joined: Tue 21 Dec 2010 15:25

Postby David Cooke » Wed 03 Aug 2011 13:54

Hi Christine,

I'm not a perl programmer but that sound plausible.

Use 'getcwd' to confirm you current working directory. See http://perldoc.perl.org/Cwd.html

Use 'chdir' to move to a different directory. See http://perldoc.perl.org/functions/chdir.html

Note there are two possible paths to the same location and I'm not sure which the above will use. You'll have to experiment.

The first is relative to the servers root directory and the other is relative to the start of your webspace.
Dave Cooke
BCA Web Services, Hidden Earth Treasurer, National Cave Registry Co-ordinator, CSCC Webmaster
David Cooke
Site Admin
 
Posts: 226
Joined: Thu 29 Dec 2005 23:22
Location: Axbridge, Somerset, UK

Postby cdonica » Wed 03 Aug 2011 15:06

Thanks for the reply :)

I did dir/ls the current working directory:
(http://thecccc.org.uk/hello3.pl)

c:/inetpub/wwwroot

.
..
iisstart.htm
images
pagerror.gif
postinfo.html
_private
_vti_cnf
_vti_inf.html
_vti_log
_vti_pvt
_vti_script
_vti_txt


But I don't recognize the structure. So, the question is, what root directory do the cccc files live in?

Christine
cdonica
 
Posts: 5
Joined: Tue 21 Dec 2010 15:25

Postby David Cooke » Wed 03 Aug 2011 18:18

OK, having played with it for a bit I've come to the conclusion there is something weird going on in FastHosts setup. It does not seem to be standard - no surprise there!

The quickest route to a solution might be to transfer your site to our Linux server - at some point I need to do this anyway since we will be turning off the windows server.

Would that be OK?

Also see http://british-caving.org.uk/wiki/doku.php?id=hosting_transfer for more info about transferring.
Dave Cooke
BCA Web Services, Hidden Earth Treasurer, National Cave Registry Co-ordinator, CSCC Webmaster
David Cooke
Site Admin
 
Posts: 226
Joined: Thu 29 Dec 2005 23:22
Location: Axbridge, Somerset, UK

Postby David Cooke » Wed 03 Aug 2011 18:27

This is FastHosts answer: http://www.fasthosts.co.uk/knowledge-base/?article_id=86

This code will return that:

Code: Select all
$webroot = substr ($ENV{'PATH_TRANSLATED'}, 0, length
($ENV{'PATH_TRANSLATED'}) - (length
($ENV{'PATH_INFO'})+(length("htdocs"))));

print $webroot;
Last edited by David Cooke on Wed 03 Aug 2011 19:08, edited 1 time in total.
Dave Cooke
BCA Web Services, Hidden Earth Treasurer, National Cave Registry Co-ordinator, CSCC Webmaster
David Cooke
Site Admin
 
Posts: 226
Joined: Thu 29 Dec 2005 23:22
Location: Axbridge, Somerset, UK

Postby cdonica » Wed 03 Aug 2011 18:53

Not a problem, I was a bit surprised when I saw the c:/... :)

I'll be on holiday for the next 6 days, and I don't have a current backup. Other than that, I don't think it should cause us any issues.

Thanks,
Chris
cdonica
 
Posts: 5
Joined: Tue 21 Dec 2010 15:25

Postby cdonica » Wed 03 Aug 2011 18:55

Thanks Dave,

I can try that code out. Also not a problem to move the site sometime.

c
cdonica
 
Posts: 5
Joined: Tue 21 Dec 2010 15:25


Return to BCA Web Services

Who is online

Users browsing this forum: No registered users and 0 guests

cron