1

I have enabled an option to create sub domain dyanamically based on this post:

post link

Here everything is working fine.

Now I am trying to load JSON formatted data by using file_get_contents() via http://dynamicsubdomain.mydomain.com. Here my code is throwing this error

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/mydomain/public_html/test.php on line 9

if I access this without sub-domain its working fine. Even though I am not able process image by using GD, this occurring same error with path.

I understood that PHP considering that sub domain as original one, but that one is not exist in A record. but I added A record with *.mydomain.com with my IP address for dynamic option.

I can remove the subdomain by regex, then access the file. its working fine..., but is there any better way to do that?

Can anyone, help me on this? not getting any clue from web.

Thanks Peter

Community
  • 1
  • 1
peterkr
  • 423
  • 2
  • 7
  • 22

1 Answers1

0

Apache may not be able to resolve your sub-domain. Try ping from the server and make sure that the name is resolved.

libregeek
  • 1,264
  • 11
  • 23
  • my domains are working fine, here..., i can access any image via browser from http://dynamicsubdomain.mydomain.com/images/my.jpg, here image displaying correctly on browser. but If i take this image url to PHP's getimagesize(), its throwing that specified error. You may understand that subdomain is working based on *.mydomain.com at DNS. it resolve with any sub domain. but PHP not understanding that one. other subdomain under domains are working perfect. example test.fusebo.com by adding A Record with host as "test" that pointing to my IP. Do you have any solution for this? – peterkr Aug 31 '11 at 13:30
  • You need to check it from the server in which PHP is running. To do this you have to login to the server and use ping or wget to test the subdomain URL. I have came across instances in which apache doesn't have updated DNS information. – libregeek Sep 01 '11 at 05:39
  • Yes its pinging successfully with all dynamic subdomains. it didn't throw any error. output shows : packets sent:4, recieved : 4 , lost :0 – peterkr Sep 01 '11 at 06:46