On page at Home › Administer › Site configuration › Subdomain settings
I have have the error:
file_get_contents(http://subdomain-test.mydomain.xcom/subdomain/test) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: HTTP request failed! in F:\Websites\Mirrors\drupal5\sites\all\modules\subdomain\subdomain_debug.inc on line 47.
HTTP request to http://subdomain-test.mydomain.xcom/subdomain/test returned the following result:
HTTP_HOST:
QUERY_STRING:
REQUEST_URI:
SCRIPT_FILENAME:
Your web server is not routing subdomains to your Drupal directory.
This is being done on my local development server. The os is Windows XP with the lighttpd server. The xcom tld is to differentiate local from the web. In the hosts file all subdomains of mydomain.xcom point to the 127.0.0.1 loop back IP address.
When I browse to the page "http://subdomain-test.mydomain.xcom/subdomain/test" I get a page with the text:
SUBDOMAIN TEST subdomain-test.hiddencastle.xcom subdomain/test /subdomain/test F:\Websites\Mirrors\drupal5/index.php
I have stepped past through line 47 in the file "subdomain_debug.inc" and find the "file_get_contents()" function returns a value of "fail" to the $page variable. The $url variable passed to "file_get_contents()" seemed correct. My browser can get to this test page but the "file_get_contents()" function cannot. What can cause this?
PHP verison 5.2.6
Lighttpd version: 1.4.22
Comments
Comment #1
setvik commentednot sure why file_get_contents is failing...
It could be that a php extension necessary for file_get_contents to make HTTP requests isn't installed in your version of PHP.
Switching that out for the built-in Drupal drupal_http_request api function is on the todo list.
You can try replacing it with drupal_http_request on your end.
If things are otherwise working, you can probably ignore that bug, since file_get_contents() is only used for requirements checking, not in normal subdomain operation.
Comment #2
spflanze commentedAfter posting this I did more experimenting and discovered that "file_get_contents()" works to get static HTML files from my local machine as well as the web. That it also can get PHP files from the web, but it cannot get PHP files from my local machine at 127.0.0.1.
I tried CURL and it did the same as "file_get_contents()."
Things were otherwise working. But I have decided to abandon Subdomain for now and use Shared Sign On instead: http://drupal.org/project/singlesignon. My purpose in using the Subdomain module was to have enabled only those modules needed for each part of the site so the hook system would compromise Drupal performance as little as possible. I recognize now this is not possible with the domain module.
When this is working I will revisit the domain module for use within a subdomain only. For SEO reasons I would like to have for the part of the site that has Organic Groups to have URLs of the form http://oggroup.forums.mydomain.com, where oggroup would be the name of the organic group. This is one deeper than is common. Is this possible?
I am looking forward to Drupal 7 which has a registration system designed to solve this performance degradation problem with increasing module numbers.