: Trying to include a file from parent domain in subdomain? I am trying to include a php file from a parent domain in a subdomain. In subdomain.parentdomain.com/test.php i have include ('/var/www/vhosts/parentdomain.com/website/
I am trying to include a php file from a parent domain in a subdomain.
In subdomain.parentdomain.com/test.php i have
include ('/var/www/vhosts/parentdomain.com/website/wp-blog-header.php');
My subdomain structure looks like
$_SERVER['DOCUMENT_ROOT'] gives /var/www/vhosts/parentdomain.com/subdomain.parentdomain.com
I have server access with plesk 11, but i don't know which php setting i have to change to enable including files from parent domain?
More posts by @Cody1181609
2 Comments
Sorted by latest first Latest Oldest Best
$url = file_get_contents('http://example.com/page.html');
You can get the contents of an external domain with this method. If this is somehow slower than calling the file directly from your server directory and that's the problem please do let me know.
If the issue is that you cannot use file_get_contents or similar commands with your PHP settings, you have to log into your PHP root control panel and modify your PHP. You need to set settings such as urlopen (or commands similar to that name) to ON. I've had to modify these settings in the past with new servers that I've setup.
You can change PHP settings and the document root.
This should will help you to include files:
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/../inc/header.php';
This part is the trick: /../
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.