Problem with PHP5
| From: | Gola, Kamil | Date: | Fri, 31 Aug 2007 08:40:52 +0000 |
| Subject: | Problem with PHP5 | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-36335@lists.php.net to get a copy of this message | ||
[English Version]
I have a problem with PHP 5. While sending picture or diffrent type of document (for instatnce MS
Word file) from PHP 5 engine to browser,
binary code distortions occur (binary code is code sent from PHP engine to browser). Within this
binary code problems happen to
characters with ASCII code below 32. It means that two characters #13#10 are autoamatically replaced
into #10 but they shoudn't.
The second failure is PHP engine stops sending output binary code after meeting #0 character but it
should send entire binary code to browser.
At hosting companies which offer PHP 5 servers those problems don't happen but those problems
occur with standard PHP 5 installation.
I would be graceful if You send me examples of php.ini or httpd.conf entries which solve this
problems.
In case it is PHP application failure I attache my PHP code sample below.
<?php
error_reporting(0);
$h=fopen('../libs/file.xls','r');
$s=fread($h,20000000);
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=LGPForm21.xls");
header("Pragma: no-cache");
header("Expires: 0");
print($s);
?>
Thanks in advance.
[Polish Version]
Mam problem z PHP 5 podczas wysyłania obrazka lub dokumentu. Błąd polega na automatycznej
konwersji przez PHP par znaków #13#10 na jeden znak o kodzie ASCII #10. Ogólny problem dotyczy
prawie wszystkich znaków o kodzie ASCII < 32. Po napotkaniu znaku o kodzie ASCII #0 PHP
przestaje wysyłać plik do przeglądarki klienta.
W firmach hostingowych nie ma tego problemu, lecz nie chcą nam udostępnić tej wiedzy. Błąd ten
występuje także w standardowej instalacji PHP 5 (EasyPHP2.0).
Prosimy o przesłanie pliku php.ini (lub pojedynczego wpisu) lub wpisu do httpd.conf łatającego
ten problem.
A może to problem kodu:
<?php
error_reporting(0);
$h=fopen('../libs/file.xls','r');
$s=fread($h,20000000);
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=LGPForm21.xls");
header("Pragma: no-cache");
header("Expires: 0");
print($s);
?>
Z góry dziękuję.