View Full Version : cgi on a subdomain
wrappedi
12-10-2008, 12:57 PM
I haw a main domain name and two subdomains. The subdomains are inside the public_html folder. The two sub domains need access to a txt file in the cgi foldier in the main domain.. Is there a special way I need to do this? So far my scripts are getting can not find file errors.
Aaron
pghcollectibles
12-10-2008, 01:39 PM
if a file was here: home/username/public_html/subdomain/index.php
and it needed this file: home/username/cgi/test.txt
the relative link would be: ../../cgi/test.txt
i dont know what type of access you are refering to: include() or src="" or something else, but some scripts need unix root paths and i would need to know more about the file that needs the txt info. unless that was enough information to solve your problem
wrappedi
12-10-2008, 04:11 PM
this is my code
open(ITEMS, "< ./items.txt")
I have tried a relative ../../items.txt
and even a direct http://www.domain.com/cgibin/items.txt
neither worked.
Aaron
pghcollectibles
12-11-2008, 06:31 AM
ok i assume this is perl and i assume the cgi directory is not in your main root but your public root as you could not type domain.com/cgi to get into your main root as a static link. also the relative link from your public_html/subfolder to your public_html/cgi folder would be ../cgi/items.txt not ./items.txt or ../../items.txt
where is the file that line of code comes from?
maybe it would be time for me to look at a tutorial (i dont know of a good one) to explain when unix type of relative prefixes are needed or not (./) that would refer to the directory you're in too by the way. (i only do: items.txt vs. ./items.txt is all im saying)
this (http://perldoc.perl.org/functions/open.html) is all i have really had time to read so far if any of this helps good, otherwise ill have to get back to you a little later. it looks like your syntax is ok for the code itself, but i do see other examples where the < is a different way but i dont know what that means yet ie:
open(ITEMS, "<", "../cgi/items.txt")vs.
open(ITEMS, "<../cgi/items.txt")but i think one of those should work
wrappedi
12-11-2008, 04:58 PM
../../cgi-bin/items.txt
worked many thanks... I thought I had tried that but guess not.
Aaron
pghcollectibles
12-11-2008, 08:33 PM
ok good. glad to help. that link must mean it was the main root cgi as i had originally thought you were saying /home/username/cgi/
welcome aboard
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.