php-windows Digest 13 Oct 2001 05:48:12 -0000 Issue 802

Topics (messages 9827 through 9831):

can't read binary files containg '0x0' character
        9827 by: Roland Divin
        9828 by: Roland Divin
        9829 by: Mark
        9830 by: Roland Divin

running PHP with mod_perl in apache
        9831 by: Derek

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hi,
I can'r read binary file that contains '0x0' character. Reading process
stops after reading '0x0' character on windows version of PHP. On Linux it
does not.

That same code gives another result on windows then on linux. Why?
(Consider file text.txt is contaning '0x0' characters. I'm using PHP4 build
from Jun 22 2001.)

$filename = "text.txt";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
echo $contents;
echo strlen($contents);
for($i=0;$i<strlen($contents);$i++)
{ echo "$i:".ord($contents[$i])."<br>"; }

Isn't it bug?

Thanks
Roland Divin


--- End Message ---
--- Begin Message ---
This error is included only in sapi/php4apache.dll. If I use CGI (php.exe)
it works perfectly.


--- End Message ---
--- Begin Message ---
On Fri, 12 Oct 2001 21:00:24 +0200, Roland Divin wrote:
>Hi,
>I can'r read binary file that contains '0x0' character. Reading
>process
>stops after reading '0x0' character on windows version of PHP. On
>Linux it
>does not.
>
>That same code gives another result on windows then on linux. Why?
>(Consider file text.txt is contaning '0x0' characters. I'm using
>PHP4 build
>from Jun 22 2001.)
>
>$filename = "text.txt";
>$fd = fopen ($filename, "r");

should be "rb" for binary files.

>$contents = fread ($fd, filesize ($filename));
>fclose ($fd);
>echo $contents;
>echo strlen($contents);
>for($i=0;$i<strlen($contents);$i++)
>{ echo "$i:".ord($contents[$i])."<br>"; }
>
>Isn't it bug?
>
>Thanks
>Roland Divin
>
>
>


--
Mark, [EMAIL PROTECTED] on 10/11/01


--- End Message ---
--- Begin Message ---
Thanks, you're right. Now it works even using dll module (not CGI) version.
Anyway it is strange that the behavior of the fread function is conditioned
whether I use dll module or CGI...

Roland

"Mark" <[EMAIL PROTECTED]> píse v diskusním príspevku
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Fri, 12 Oct 2001 21:00:24 +0200, Roland Divin wrote:
>Hi,
>I can'r read binary file that contains '0x0' character. Reading
>process
>stops after reading '0x0' character on windows version of PHP. On
>Linux it
>does not.
>
>That same code gives another result on windows then on linux. Why?
>(Consider file text.txt is contaning '0x0' characters. I'm using
>PHP4 build
>from Jun 22 2001.)
>
>$filename = "text.txt";
>$fd = fopen ($filename, "r");

should be "rb" for binary files.

>$contents = fread ($fd, filesize ($filename));
>fclose ($fd);
>echo $contents;
>echo strlen($contents);
>for($i=0;$i<strlen($contents);$i++)
>{ echo "$i:".ord($contents[$i])."<br>"; }
>
>Isn't it bug?
>
>Thanks
>Roland Divin
>
>
>


--
Mark, [EMAIL PROTECTED] on 10/11/01




--- End Message ---
--- Begin Message ---
If I use perl as CGI in my apache server PHP works fine for me.If I use
mod_perl
instead of pure CGI I always got an 'Internal Server Error'.And in the log
it said:

Bareword found where operator expected at (eval 18) line 3, near "#line 1
e:/my documents/my webs/a.php
<h1>hello"
 (Missing operator before hello?)
[Sat Oct 13 13:42:23 2001] [error] Search pattern not terminated at (eval
18) line 3.

my test php file is like this

<h1>hello</h1>
<?php  phpinfo(); ?>

Could somebody give me a hand?

Derek


--- End Message ---

Reply via email to