[PHP] Re: Executing Script through image

2002-07-10 Thread JJ Harrison

It is a couple of seconds slow.

Treating the file as an image means that the rest of the page can still load
while it is doing the reverse DNS lookup and executing the script.

Anyway I have got the answer now


--
JJ Harrison
[EMAIL PROTECTED]
www.tececo.com


Richard Lynch [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 When the nessicary include file is included it does a reverse-DNS lookup
to
 find the remote host's DNS name. The problem with this is that is seems
 slow(at least on my test server with a DSL connection).

 How slow?

 There's, like, a couple seconds slow, which is just how slow reverse-DNS
can
 be, and *MINUTES* slow...


 Minutes slow, most likely, indicates that where-ever you are trying to
look
 up the DNS records is trying to do a reverse DNS on *YOU* (or, rather,
PHP's
 web-server) and timing out.

 If you have any control over that machine where you are doing the
 reverse-DNS, be sure they have your IP address associated with a name.

 For DSL, you can use something like http://dyndns.org to give your dynamic
 IP address a domain name.  There are dozens of competitors to
 http://dyndns.org, and feel free to shop around.

 I thought the best
 way to speed things up would be putting the entire script into a file and
 then using img src=stats.php within the page. The problem is that I
 don't know how to output the image with PHP.

 Like, I don't even understand the theory here...

 How would the script being in a file (and where is it now?) make the DNS
 lookups any faster?  I'm so confused.

 At any rate, a sample of how to dump out an image was already posted in
this
 thread.

 --
 Like Music?  http://l-i-e.com/artists.htm




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Executing Script through image

2002-07-09 Thread BB

$filename = your/file.gif;
header(Content-Type: image/gif);
header(Content-length:.filesize($filename));
$fn=fopen($filename,rb);
while(!feof($fn)) {
 echo fread($fn, 4096);
}

in fopen( , );
the b denotes to read as binary and is only nessecary on a windows system

Jj Harrison [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I am making a stats program.

 When the nessicary include file is included it does a reverse-DNS lookup
to
 find the remote host's DNS name. The problem with this is that is seems
 slow(at least on my test server with a DSL connection). I thought the best
 way to speed things up would be putting the entire script into a file and
 then using img src=stats.php within the page. The problem is that I
 don't know how to output the image with PHP.

 The image would not be dynamic just a file on the server.

 I would appreciate peoples comments or other suggestions

 JJ Harrison
 [EMAIL PROTECTED]
 www.tececo.com








-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Executing Script through image

2002-07-09 Thread Marek Kilimajer

instead of

$fn=fopen($filename,rb);
while(!feof($fn)) {
 echo fread($fn, 4096);
}

use

readfile($filename);

BB wrote:

$filename = your/file.gif;
header(Content-Type: image/gif);
header(Content-length:.filesize($filename));
$fn=fopen($filename,rb);
while(!feof($fn)) {
 echo fread($fn, 4096);
}

in fopen( , );
the b denotes to read as binary and is only nessecary on a windows system

Jj Harrison [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  

I am making a stats program.

When the nessicary include file is included it does a reverse-DNS lookup


to
  

find the remote host's DNS name. The problem with this is that is seems
slow(at least on my test server with a DSL connection). I thought the best
way to speed things up would be putting the entire script into a file and
then using img src=stats.php within the page. The problem is that I
don't know how to output the image with PHP.

The image would not be dynamic just a file on the server.

I would appreciate peoples comments or other suggestions

JJ Harrison
[EMAIL PROTECTED]
www.tececo.com










  




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Executing Script through image

2002-07-09 Thread Richard Lynch

When the nessicary include file is included it does a reverse-DNS lookup to
find the remote host's DNS name. The problem with this is that is seems
slow(at least on my test server with a DSL connection).

How slow?

There's, like, a couple seconds slow, which is just how slow reverse-DNS can
be, and *MINUTES* slow...


Minutes slow, most likely, indicates that where-ever you are trying to look
up the DNS records is trying to do a reverse DNS on *YOU* (or, rather, PHP's
web-server) and timing out.

If you have any control over that machine where you are doing the
reverse-DNS, be sure they have your IP address associated with a name.

For DSL, you can use something like http://dyndns.org to give your dynamic
IP address a domain name.  There are dozens of competitors to
http://dyndns.org, and feel free to shop around.

I thought the best
way to speed things up would be putting the entire script into a file and
then using img src=stats.php within the page. The problem is that I
don't know how to output the image with PHP.

Like, I don't even understand the theory here...

How would the script being in a file (and where is it now?) make the DNS
lookups any faster?  I'm so confused.

At any rate, a sample of how to dump out an image was already posted in this
thread.

-- 
Like Music?  http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php