NameSilo

Subdomains and php?!

Spaceship Spaceship
Watch

PoorDoggie

Soon to be RICHdoggie!VIP Member
Impact
18
I have two folders on my server, lets call them "folder1" and "folder2".

folder1 is "linked" to a subdomain: folder1.domain.co.uk
folder2 is "linked" to a subdomain: folder2.domain.co.uk

I have a file in folder1 that I want to php include() into a file in folder2. Obviouslly people are going to be using the subdomains, so there is no way I can access folder1 without going through the subdomain folder1.domain.co.uk.

Now for some reason if I do:
PHP:
include('http://folder1.domain.co.uk/thisfile.php');
and save the file as http://folder2.domain.co.uk/anotherfile.php it won't include it.

Even if I have the include() file in www.domain.co.uk/anotherfile.php.

Is there anyway to get this to work? Or is there anyway to access folder1 from the folder2 subdomain?

I hope I have explained well! I have just made myself even more confused! :lol:

Thanks in advance
Tom
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
eh, im a little confused... but the easiest thing i can think of is to just put a copy of that file in both folders hehe :D
 
0
•••
The best thing i can say, all the files are on the same server/account right?

Use full paths.

Code:
/home/username/public_html/FOLDERNAME/thisfile.php

This will work, its not good to include URLS
 
0
•••
axilant said:
The best thing i can say, all the files are on the same server/account right?

Use full paths.

Code:
/home/username/public_html/FOLDERNAME/thisfile.php

This will work, its not good to include URLS
Great thanks! :) how do I find out that string? I know that mine isn't like that.
 
0
•••
PoorDoggie said:
Great thanks! :) how do I find out that string? I know that mine isn't like that.


look on cpanel

or log into your ftp account and see what the path is on there
 
0
•••
What control panel do you use? Cpanel is always like that... But then agian, are you using plesk? (I never used plesk)

Just do a simple google:

Controlpanelname: find my full path?

and im sure you will find out how to do so.
 
0
•••
Amnezia said:
look on cpanel

or log into your ftp account and see what the path is on there
ftp account is ftp.theshutter.co.uk :( and I use 1and1 so no cpanel! :(

Thanks axillant - will search.

then I just put "inlcude('home/username/public_html/folder1')" and the server will understand that?
 
0
•••
Contact me on msn. You know my address right? [email protected] ill hook you up with cpanel, for free.
 
0
•••
log into your ftp account, navigate to the folder which contains the file you want to include then look at the address bar on your ftp software, this will give the you the full path of the directory
 
0
•••
1and1 i honestly thought they were only domain names until now... lol
 
0
•••
or you could just use domain.co.uk/folder2/file
 
0
•••
Create a file called serverpath.php
PHP:
<?php
$path= $_SERVER['PATH_TRANSLATED'];
print ("$path");
?>

Should give you your servers full path.
 
0
•••
when you do include('http://folder1.domain.co.uk/thisfile.php'); it is actually including what that script outputs as it is being parsed before it is included.

This is obviously not what you want, you have to include it using as has been said using the full server path.
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back