||03-04-2008 06:04 PM
Safe way to read file from subdomain <-> maindomain?
Is there way (safe way) to read file from subdomain <-> maindomain?
Real-life scenario ;): I have subdomain (orders.mydomainx.com) and I need to read main function file from maindomain's (mydomainx.com) include folder. Possible? Hope so..
Thanks for all help!
||03-04-2008 07:17 PM
I'm guess the files are on the same machine so all you would need to know is the path on how to get from the subdomain files to the main domain files. Or the absolute path.
||03-04-2008 07:42 PM
Say you have the following file / folder structure:
To access include.html you would do the following:
As you would in html
<img src="../image.gif" alt="bla" />
The two periods (
) mean that you are going a directory back (ie one . would mean you are in the same directory, two . would mean you go back one, three . would be going back two directories).
To access another.html in sub.html
You would have to go back a directory, then forward another one. Ie:
Alternatively you could use
Hope this helps
||03-05-2008 10:44 AM
Yes if folder structure looks like you show this would be easy but it isn't.. ;)
In this case folder structure looks like following:
In my main domain root folder has
httpdocs <- where is main domain files
subdomains <- where is all subdomain folders
folder view is for my main domain:
in main subdomain folder, in each own subdomain folder has same folder hierarcy as main domain folders.
And if I try to include from my main domain files
I got this in error_log:
PHP Warning: include() [<a href='function.include'>function.include</a>]: open_basedir restriction in effect. File(/var/www/vhosts/mydomainname/httpdocs/include/include_file.php) is not within the allowed path(s): (/var/www/vhosts/mydomainname/subdomains/mysubdomainname/httpdocs:/tmp) in /var/www/vhosts/mydomainname/subdomains/mysubdomainname/httpdocs/orders.php on line 1
something about open_basedir?
Sorry about my first post, I haven't describe my problem good enough..
I have dedicated server, CentOS5 and Plesk 8.3 installed.
Thanks for all help!
||03-05-2008 09:24 PM
You can try turning off
in your php.ini file (just comment it out). Before doing that you may want to try chdir
right before you include the file and then change the directory back after you've included the file. It may be easier just to turn off
|All times are GMT. The time now is 06:31 AM.
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0