473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

php include - dns issue?


On 'sub1.othercompany.com' there is a simple php file with an include that
calls a script on my company's server 'sub2.mycompany.com'

The script on my company's server seems to work fine when I test it alone in
the browser(it generates some xml) but when I attempt to call it from the
other companies server as an include, I cannot access it. I *can* get to it
from the include when I use the IP address.

According to my company's IT guy there are no issues with our DNS. According
to the other company they are not restricting outbound access to
'sub2.mycompany.com'.

Testing something along the lines of:
$socket = fsockopen ($Connection, $Port, $errno, $errstr, $Timeout);
print "Error $errno: $errstr";

gives:

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: No address associated with hostname in
/usr/local/www/sub1.othercompany.com/xml/socket_test.php on line 25

Warning: fsockopen() [function.fsockopen]: unable to connect to
sub2.mycompany.com:80 (Unknown error) in
/usr/local/www/sub1.othercompany.com/xml/socket_test.php on line 25

Any thoughts on the issue? Are there any diagnostic methods I can use to
troubleshoot what the issue is?

TIA
David
Nov 22 '05 #1
2 2842
>On 'sub1.othercompany.com' there is a simple php file with an include that
calls a script on my company's server 'sub2.mycompany.com'
Why do people do this? It seems terribly risky.
The script on my company's server seems to work fine when I test it alone in
the browser(it generates some xml) but when I attempt to call it from the
other companies server as an include, I cannot access it. I *can* get to it
from the include when I use the IP address.
If the include works with an IP address and not with a hostname,
all other things being equal, including the PHP running on the same
server both times, you have a DNS problem of some sort.
You've also eliminated a number of issues regarding allowing
remote urls and safe mode.

One possibility to consider is that the host name and the IP address
do not point to the same place. Another possibility is that if the
DNS for the host name just changed, it might be out of date on the
servers the PHP host is running on. (Allow at least 4 days for changes
to take - and no, I really don't care that YOU always observe changes
to mycompany.com DNS take in under 60 seconds. The rest of the world
doesn't use your DNS servers to do all their queries.)
According to my company's IT guy there are no issues with our DNS. According
to the other company they are not restricting outbound access to
'sub2.mycompany.com'.
If you can get to it by IP address, the other company's guy is right.
Testing something along the lines of:
$socket = fsockopen ($Connection, $Port, $errno, $errstr, $Timeout);
print "Error $errno: $errstr";

gives:

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: No address associated with hostname in
/usr/local/www/sub1.othercompany.com/xml/socket_test.php on line 25

1. Find out what's in /etc/resolv.conf on the PHP server - which
DNS servers it's using.
2. Ask *THOSE* servers for the IP address of sub2.mycompany.com.
dig @hosting.company.dns.server sub2.mycompany.com
Do you get the correct answer from all of them?

It sounds like the complaint is (a) the domain doesn't exist, or
(b) the host doesn't exist (has no A record or CNAME record, or
the CNAME record points to someplace nonexistent), or (c) the
PHP host has broken DNS configuration and can't resolve *any*
hostnames (unlikely, as the web server would likely complain).

Another thing to do is to trace the DNS all the way from the root.
If the registration for mycompany.com expired and Network Solutions
turned it off, and you host your own DNS locally, you might not
notice the problem, since it works for you, but not for the rest
of the world. The same thing happens if the officially registered
servers for the domain point at the wrong place.
Warning: fsockopen() [function.fsockopen]: unable to connect to
sub2.mycompany.com:80 (Unknown error) in
/usr/local/www/sub1.othercompany.com/xml/socket_test.php on line 25

Any thoughts on the issue? Are there any diagnostic methods I can use to
troubleshoot what the issue is?


Gordon L. Burditt
Nov 22 '05 #2
David Arden Stevensonn wrote:
On 'sub1.othercompany.com' there is a simple php file with an include that
calls a script on my company's server 'sub2.mycompany.com'

The script on my company's server seems to work fine when I test it alone in
the browser(it generates some xml) but when I attempt to call it from the
other companies server as an include, I cannot access it. I *can* get to it
from the include when I use the IP address.

According to my company's IT guy there are no issues with our DNS. According
to the other company they are not restricting outbound access to
'sub2.mycompany.com'.

Testing something along the lines of:
$socket = fsockopen ($Connection, $Port, $errno, $errstr, $Timeout);
print "Error $errno: $errstr";

gives:

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: No address associated with hostname in
/usr/local/www/sub1.othercompany.com/xml/socket_test.php on line 25

Warning: fsockopen() [function.fsockopen]: unable to connect to
sub2.mycompany.com:80 (Unknown error) in
/usr/local/www/sub1.othercompany.com/xml/socket_test.php on line 25

Any thoughts on the issue? Are there any diagnostic methods I can use to
troubleshoot what the issue is?

TIA
David


include() on a file only works if you are on the same server (or have a
shared disk between servers).

When you include from an ip address, the request goes to the web server
which then processes it like it would any other PHP file.

If you change the extension to something not parsed by the server, you
will get the source code and be able to use it - but you'll be operating
on the remote machine and only have the resources (database, etc.) the
other machine has available to it.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or something I don’t get)? The path in include is...
9
by: Tom Cat | last post by:
Is there anything wrong with using a lot of include files? On one part of my website, I have a form. The page it posts data to, includes a different file based on some of the values. The...
2
by: chopper | last post by:
Please excuse the long post but I can't think of shorter way of explaining the issue. Please could someone advise on the following: I'm writing preview functionality for a CMS written in ASP....
5
by: Jonathan Ng | last post by:
Hi, I was wondering if there was a way to include the white spaces in a string. Currently, I am using: scanf("%s", &input); However, this doesn't include the 'space' character or any other...
5
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
3
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include ...\ProjectB\Dist\Include Each of the include...
0
by: ChronoFish | last post by:
Hello, I have a script that does a remote include (does not matter if I do include(), file(), require(), etc, the result is the same). The script spins for a long time and then will finally...
5
by: Tio | last post by:
I have project in MFC(vc++) . There are files and classes: classes:dialog1,dialog2,aaa,bbb ---------------------- main.cpp --------------------- #include "mainfrm.h" #include "dialog1.h"...
2
by: --== Alain ==-- | last post by:
Hi, Under VC++.NET, i have a stupid issue with #include statement. Usually when we include some *.h file, we need to declare them before any #using <or #using namespace... to avoid issue at...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.