php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18305 PHP Produces Garbage in output with SAPI DLL and Apache2.0.39
Submitted: 2002-07-12 07:53 UTC Modified: 2002-07-12 08:53 UTC
From: psychoticwolf at carolina dot rr dot com Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 4CVS-2002-07-12 OS: Windows XP Professional
Private report: No CVE-ID: None
 [2002-07-12 07:53 UTC] psychoticwolf at carolina dot rr dot com
PHP Produces Garbage in output with SAPI DLL (php4apache2.dll) and Apache2.0.39

The output data from the MySQL Query (included below), is either truncated or mixed in with "garbage" characters.. 

 ??hNT?ZTh?Z???Z??? (etc..)

Which results in a jumbled display of the query. 

Information that seems to be relevant.. is that the bug does not appear when accessing the script from localhost.. only from another machine.. The MySQL query as it's written below
would pull all 19 records of a 23.8kb MySQL table.. 

<!-- MySQL PHP Query-->
<?php

  $sql = "SELECT * FROM `jakesnote` ORDER BY `id` DESC LIMIT 0, 50";
  $sql_result = mysql_query($sql, $connection) or die ("Could not get Query"); 
  while ($row = mysql_fetch_array($sql_result)) {
  $id = $row["id"]; 
  $date = $row["date"];
  $info = $row["info"];
  $whatsnew = $row["whatsnew"];

    
	$day=substr($date,6,2);  //get the day
    $month=substr($date,4,2); //get the month
    $year=substr($date,0,4); //get the year
	$hour=substr($date,8,2); //get the hour
	$minute=substr($date,10,2); //get the minute
	$sec=substr($date,12,2); //get the sec
//    $mydate ="$month/$day/$year - $hour:$minute:$sec"; //var to be returned
    $mydate ="$month/$day/$year"; //var to be returned
  

  echo"<TR><TD ALIGN=CENTER height=\"20\" class=\"Header1\"><b><font size=\"4\">Updated: $mydate</font></b></TD></TR>";
  echo"<TR><TD ALIGN=LEFT><FONT SIZE=\"4\">$info</FONT></TD></TR>";
  echo"<TR><TD ALIGN=LEFT><FONT SIZE=\"4\"><B><I>What's New?</I></B></FONT><BR>$whatsnew</TD></TR>";
 }
 
?>


-- Config.php (Required Included file for MySQL Setup --
<?php

//-- Website Setup --//

$siteDrive="d:";
#siteDrive="e:";
$sitePath="websites//crushme";
#sitePath="ServerFiles//Websites//crushme";
$siteInstall="$siteDrive//$sitePath";
$siteInclude="mydata";
$siteDataPath="$siteInstall//$siteInclude";

#siteDomain="http://crushme.clients.philipnz.com";
$siteDomain="http://crushme.dyndns.org";

//-- My Sql Mgt --//

$mysqlServer="localhost";
$mysqlLogin="root";
$mysqlPass="";
$mysqlData="jakesplace";

$connection = mysql_connect("$mysqlServ","$mysqlLogin","$mysqlPass") or die ("Could not connect to Server");
$db = mysql_select_db("$mysqlData", $connection) or die ("Could not select database!");

//-- Header and Footer --//

$page_head="$siteDataPath/page_head.php";
$page_foot="$siteDataPath/page_foot.php";

?>

I've also observed this bug without MySQL.. when having PHP include a 27kb static html document.

<?php

require"../config.php";
include"$page_head";

include"home.htm";

include"$page_foot";
?>

Both the above scripts/files worked correctly on Apache 2.0.36 with php4apache2.dll loaded as a DSO.. PHP version (4.2.1)..

The errors began after upgrading to Apache 2.0.39 (with PHP 4.2.2-dev (July 3rd edition)... and still exist in the current 4.2.2-dev CVS version..--  (Build Date Jul 12 2002 10:13:33.) The error is more randomized in the current -stable CVS build.. than the 7/3 one.. which had it occuring constantly.


The errors do not occur when using Apache 1.3.26 with the same PHP Edition.. (only difference, obviously, is the SAPI DLL for Apache and Apache2..)

An attempt to check the current branch of 4.3.0-dev in CVS for Win32 failed because Apache2 crashed. So I don't know if it's fixed in that build or not.

I have been able to recreate the error on another machine using the same versions of the software. Don't know if this'll be of any use.. but the MySQL version is 3.23.51.

Thanks in advance

-- Chris

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-12 08:53 UTC] sander@php.net
PYou need the latest CVS of both PHP and Apache2.
Please reopen this report if it still persists with the latest CVS HEAD (4.3.0-dev) of PHP and the latest CVS of Apache (2.0.40).
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Feb 03 11:03:46 2023 UTC