Why Would PHP Improperly Resolve a Local URL?
Posted: Fri Mar 30, 2007 6:37 pm
OK - This has me very, very stumped....
We operate about 20 domains on a leased server.
Code started "breaking" all over the place, where it involved directly accessing other URLs on our sites.
For example:
(the application is much more complex, but this is a simple test case that works).
PHP can no longer find files this way (the above returns a 404 - Not found).
But paste that URL in a browser, and it's fine!
After *MUCH* futzing-around for the past three days, we finally figured-out what's going-on.... PHP (only) is resolving http://domain1.com/index.php to http://domain2.com/index.php!!!???
(domain2 is another of our domains on the same server)
This (DNS?) anomaly only affects PHP - <a href="http://domain1.com/index.php"> works just fine.
How can it be that on one domain, on one box, <a href="http://domain1.com/index.php"> resolves correctly, but file_get_contents("http://domain1.com/index.php") resolves to a completely different domain on the same server?
(BTW - Everything after the domain name is preserved. It's only the domain part of the URL that gets transposed by PHP).
I should also add that everything has been working fine for more than a year. The problem only started recently, and our server guy(s) say they've changed nothing?
Thanks in advance for any suggestions.
We operate about 20 domains on a leased server.
Code started "breaking" all over the place, where it involved directly accessing other URLs on our sites.
For example:
Code: Select all
echo file_get_contents("http://domain1.com/index.php");PHP can no longer find files this way (the above returns a 404 - Not found).
But paste that URL in a browser, and it's fine!
After *MUCH* futzing-around for the past three days, we finally figured-out what's going-on.... PHP (only) is resolving http://domain1.com/index.php to http://domain2.com/index.php!!!???
(domain2 is another of our domains on the same server)
This (DNS?) anomaly only affects PHP - <a href="http://domain1.com/index.php"> works just fine.
How can it be that on one domain, on one box, <a href="http://domain1.com/index.php"> resolves correctly, but file_get_contents("http://domain1.com/index.php") resolves to a completely different domain on the same server?
(BTW - Everything after the domain name is preserved. It's only the domain part of the URL that gets transposed by PHP).
I should also add that everything has been working fine for more than a year. The problem only started recently, and our server guy(s) say they've changed nothing?
Thanks in advance for any suggestions.