Page 1 of 1
loss of name resolution
Posted: Tue Sep 09, 2003 10:28 am
by mesz
Why do I get these errors:
Code: Select all
Warning: main() їfunction.main]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/.sites/14/site467/web/illustration/ill_one.php on line 2
Warning: main(http://www.distortedmedia.co.uk/illustration/template.php) їfunction.main]: failed to create stream: Resource temporarily unavailable in /home/.sites/14/site467/web/illustration/ill_one.php on line 2
Fatal error: main() їfunction.main]: Failed opening required 'http://www.distortedmedia.co.uk/illustration/template.php' (include_path='') in /home/.sites/14/site467/web/illustration/ill_one.php on line 2
Is this a server problem, or something I could correct?
Posted: Tue Sep 09, 2003 10:36 am
by JAM
Could you paste the line 1-3 of ill_one.php ?
Posted: Tue Sep 09, 2003 10:39 am
by e4c5
'Temporary failure in name resolution' is a system error. Why are you trying to include an http url instead of a local file?
Posted: Tue Sep 09, 2003 10:40 am
by JayBird
it basically means that your script is trying to resolve a hostname/url and it is failing.
What is on line 2 of your ill_one.php document?
Mark
Posted: Tue Sep 09, 2003 11:23 am
by mesz
The first 6 lines of ill_one.php
Code: Select all
<?php
<?PHP
require('http://www.distortedmedia.co.uk/illustration/template.php');
?>
<div class="main_col_L">
<br>
<div align="center">
?>
This sometimes works ( infact the majority of the time ) but then sporadically fails.
I suspect the system error.
Posted: Tue Sep 09, 2003 11:29 am
by JayBird
is the file you are requiring on your server?
If so, why are you using a full url?
a server path would be far better.
Mark
Posted: Wed Sep 10, 2003 3:51 am
by mesz
The server path previously was also
experiencing this problem, so in desperation I put a full URL in it's place.
The template file is on my server - like I said, sometimes it works, sometimes it doesn't - I thought it must be a bit of dodgy php script by me, but I have other sites with the same piece of code without any problem?
Posted: Wed Sep 10, 2003 4:18 am
by JayBird
change your rquire line to these two lines
Code: Select all
$BasePath = str_repeat("../", substr_count(dirname($_SERVER["SCRIPT_NAME"]), "/"));
require($BasePath."illustration/template.php');
See if that is any good.
Mark
Posted: Wed Sep 10, 2003 4:35 am
by mesz
I shall try that in the minute - bit swamped with other work for the next hour though!
Cheers for your help
Posted: Wed Sep 10, 2003 5:10 am
by mesz
Changed it to this:
Code: Select all
<?php
$BasePath = str_repeat("../", substr_count(dirname($_SERVER["SCRIPT_NAME"]), "/"));
require($BasePath."illustration/template.php');
?>
Get this error
Code: Select all
Parse error: parse error, unexpected T_STRING in /home/.sites/14/site467/web/illustration/ill_one.php on line 5
Posted: Wed Sep 10, 2003 5:24 am
by JayBird
sorry, my bad, missed a double quote
Code: Select all
<?php
$BasePath = str_repeat("../", substr_count(dirname($_SERVER["SCRIPT_NAME"]), "/"));
require($BasePath."illustration/template.php");
?>
Mark
Posted: Wed Sep 10, 2003 6:16 am
by mesz
equally though, I should have checked....being lazy.
Cheers for your help...again
Posted: Wed Sep 10, 2003 6:20 am
by mesz
Just tried this and it works..............
I understand that
$BasePath = str_repeat
assigns a variable that repeats...
however what does this refer to?
Why script name?
I have not heard of this before?
("../", substr_count(dirname($_SERVER["SCRIPT_NAME"]), "/"));
Posted: Wed Sep 10, 2003 6:33 am
by JayBird
Basically, is gets the directory path the current script is running in, then counts how many “/” there are in it and replaces them with “../”
$BasePath will then equal enough “../” to get back to the root of the webserver to include/require the file.
Mark
Posted: Wed Sep 10, 2003 7:28 am
by mesz
that makes sense....
cheers.