php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48233 The Page Cannot Be Displayed
Submitted: 2009-05-11 14:08 UTC Modified: 2009-05-11 17:27 UTC
From: ralphyz at gmail dot com Assigned:
Status: Not a bug Package: IIS related
PHP Version: 5.2.9 OS: W2K3 SP2
Private report: No CVE-ID: None
 [2009-05-11 14:08 UTC] ralphyz at gmail dot com
Description:
------------
I get "The Page Cannot Be Displayed" error message when there are 3 print statements in a row which display the contents of an array (which only has 1 column, and 3 rows).  When I comment out any of the three print statements, the page displays without a problem.  

I tested this code on Ubuntu - and it works without a problem.

Also commenting out any of the following three lines makes this work without a problem:
    print ("id: $id <BR>");
    print ("name:" . $name . "<BR>");
    print ("description:" . $description . "<BR>");

If I comment out any of those lines, but replace the "IF" statement with a "FOR" statement to run through all my records ($num_rows = 31), I get the same error (The Page Cannot Be Displayed).

The print statements with "got here" in them seem to have no negative effect on the script.

Reproduce code:
---------------
<?php

$DBHost = "x.x.x.x";            // IP-address of MySQL server
$DBLogin = "username";          // Username of MySQL user
$DBPassword = "password";       // Password of MySQL user
$DBDatabase = "database";       // Name of database
$db_error = "";

$sql = "select A, B, C from employee";

$data_set = get_data($sql);

$num_rows = mysql_num_rows($data_set);

if($num_rows > 0)
{
     $row = mysql_fetch_array($data_set, MYSQL_NUM);

      $id = $row[0];
      $name = $row[1];
      $description = $row[2];

    print ("id: $id <BR>");
    print ("name:" . $name . "<BR>");
    print ("description:" . $description . "<BR>");

print ("got here");
print ("got here");
print ("got here");
print ("got here");
print ("got here");
print ("got here");
print ("got here");
print ("got here");
print ("got here");
print ("got here");
}


function get_data($sql)
{
      global $DBHost, $DBLogin, $DBPassword, $DBDatabase, $db_error;

      if(!mysql_connect("$DBHost", "$DBLogin", "$DBPassword"))
      {
        return "$db_error";
      }
      else
      {
        mysql_select_db("$DBDatabase");
        return mysql_query($sql);
      }
}
?>

Expected result:
----------------
This should display:

  1
  John Smith
  Staff
  got heregot heregot heregot heregot heregot heregot heregot heregot heregot here

Actual result:
--------------
 The page cannot be displayed 
There is a problem with the page you are trying to reach and it cannot be displayed. 

--------------------------------------------------------------------------------

Please try the following:

Open the x.x.x.x home page, and then look for links to the information you want. 
Click the  Refresh button, or try again later.

Click  Search to look for information on the Internet. 
You can also see a list of related sites. 




HTTP 500 - Internal server error 
Internet Explorer  


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-11 14:14 UTC] johannes@php.net
When using the mysqli extension together with the mysql extension
you have to use the same libraries and include files. mysqli
extension requires the location of mysql_config file, mysql
extension requires the path of your mysql installation.

If you installed MySQL 4.1 for example with prefix /usr/local/mysql-4.1
your configure settings should be
--with-mysql=/usr/local/mysql-4.1
--with-mysqli=/usr/local/mysql-4.1/bin/mysql_config

I case that is correct please check your log files for more verbose error messages.
 [2009-05-11 14:36 UTC] ralphyz at gmail dot com
There are no errors in the log file.  

The following lines:
    print ("id: $id <BR>");
    print ("name:" . $name . "<BR>");
    print ("description:" . $description . "<BR>");

All work individually (two others are commented out), or in pairs (one other is commented out).  I get the error when all three are active (none of the three commented out).  

They also work if I do this:
    print ("id: $id <BR>name: $name<BR>description: $description");

It just won't work if I have three separate lines.  No other code gives me an error.
 [2009-05-11 14:50 UTC] ralphyz at gmail dot com
When I access the same page from Firefox, I get an Access Violation error - but again, only when all three lines are uncommented.
 [2009-05-11 15:10 UTC] ralphyz at gmail dot com
Turning off "Show friendly HTTP error messages" in IE now gives me the Access Violation error message instead of "The page cannot be displayed."
 [2009-05-11 17:27 UTC] ralphyz at gmail dot com
Reinstalled PHP 5.2.9 - everything is working now.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 09 19:01:27 2024 UTC