Closed Thread Icon

Topic awaiting preservation: PHP Error Messages Just Stopped. (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=24239" title="Pages that link to Topic awaiting preservation: PHP Error Messages Just Stopped. (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: PHP Error Messages Just Stopped. <span class="small">(Page 1 of 1)</span>\

 
WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 11-30-2004 18:31

I am working on a project in PHP and the errors just stopped showing up. Instead I get a blank page with the following source:

code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>



I tried adding error_reporting(E_ALL); to all of my scripts and still no errors are being reported. I have even put syntax errors into the code and nothing shows up. I would give some code but I don't think it would be of any use since I don't know where the error is and there is a lot of code.

Once change I made that I am not sure about is that I am now using require_once(...) instead of include().

Anyone have any ideas?

Dan @ Code Town

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 12-01-2004 07:43

that blank page probably is just that: The page your browser displays when the server didn't even return a single byte.

Have you tried calling a page containing just php->phpinfo to see if php is still working at all?

so long,

->Tyberius Prime

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 12-01-2004 16:33

PHP is running. PHP info is working.

I am wondering why the server is not not returning anything as opposed to throwing an error message.

Ever experience this problem? It is a first for me.

Thanks,

Dan @ Code Town

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 12-01-2004 17:06

Here is my code, with important bits taken out. I am sure there are errors in here, but I am looking for why it is not displaying what they are.

/index.php

code:
<?php include($_SERVER['DOCUMENT_ROOT'] . "/t/head.php"); ?>

<h1 id="title">Test 1</h1>

<div id="content">
<h1>Please Login</h1>
<p>Please Login.</p>
</div>

<div id="menu">

<div id="login">
<?php echo(login->get_login_box()); ?>
</div>

<div id="links">

</div>
</div>

<?php include($_SERVER['DOCUMENT_ROOT'] . "/t/foot.php"); ?>



/t/head.php

code:
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/c/global.php"); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test 1</title>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />

<style type="text/css" media="all">@import "/s/style01.css";</style>
</head>
<body>



/c/global.php

code:
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/c/mysqldb.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/c/login.php");

session_start();
$database = new mysqldb();
$login = new login();
?>



/c/mysqldb.php

code:
<?php

class mysqldb {

var $dbhost;
var $db;
var $dbuser;
var $dbpassword;
var $results;
var $numberrows;
var $connection;
var $database;

function mysqldb() {
$this->dbhost = "localhost";
$this->db = "####";
$this->dbuser = "####";
$this->dbpassword = "####";
$this->connection = mysql_connect($this->dbhost,$this->dbuser,$this->dbpassword);
$this->database = mysql_select_db($this->db);
}

function query($sql){
$this->results = mysql_query($sql) or die ("The query has failed. " . mysql_error());
return $this->results;
}

}
?>



/c/login.php

code:
<?php

class login{

var $loginerror = "";

function login(){
$this->loginerror = "";
}

function get_error(){
return $this->loginerror;
}

function do_login($username,$password){
error_reporting(E_ALL);
//Validate Input
if(!preg_match("/^\w{4,16}$/",$username)
|| !preg_match("/^\w{8,16}$/",$password) ) return false;

$sql = "SELECT id, first_name, last_name FROM user WHERE ";
$sql.= "username = '" . $username . "' and ";
$sql.= "password = '" . md5($password) . "'";

$results = $database->query($sql);

if(!$results){
$this->loginerror = "Could not perform the query for the username and password.";
return false;
}

$num_rows = mysql_num_rows($results);

if($num_rows != 1){
$this->loginerror = "Could not match the username or password.";
return false;
}

$line = mysql_fetch_array($results);
$id = $line['id'];
$first_name = $line['first_name'];
$last_name = $line['last_name'];
$datetime = date("Y-m-d H:m:s");
$session_string = #######;
$session_hash = md5($session_string);

$sql = "UPDATE user SET last_login = '" . $datetime ."', ";
$sql.= "session_hash = '" . $session_hash . "' WHERE ";
$sql.= "id = " . $id;

$results = $database->query($sql);

if(!$results){
$this0>loginerror = "Could not update the the user information.";
return false;
}

$_SESSION['id'] = $id;
$_SESSION['session_hash'] = $session_hash;
$_SESSION['first_name'] = $first_name;
$_SESSION['last_name'] = $last_name;*/

return true;
}

function is_logged_in(){

$id = "";
$session_hash = "";

if(isset($_SESSION['id']) && isset($_SESSION['session_hash'])){
$id = $_SESSION['id'];
$session_hash = $_SESSION['session_hash'];
}
else {
$this->loginerror = "The user's session is not set.";
return false;
}

//Validate the input again, can't be too careful
if(!preg_match("/^\w{32}$/",$session_hash) || !preg_match("/^\d{1,32}$/",$id)){
$this->loginerror = "The user's session informatio is malformed.";
return false;
}

$sql = "SELECT " . $id . " FROM user WHERE ";
$sql.= "session_hash = " + $_SESSION['session_hash'];

$results = $database->query($sql);

if(!$results || mysql_num_rows($results) != 1){
$this->loginerror = "The session information is invalid.";
return false;
}

$line = mysql_fetch_array($results);
$id2 = $line['id'];

if($id != $id2){
$this->loginerror = "The session id is invalid.";
return false;
}

return true;
}

function get_login_box(){
if(!is_logged_in()){
$output = '<form method="POST" action="/login.php">';
$output.= '<label>Username</label>';
$output.= '<input type="text" name="username"/>';
$output.= '<label>Password</label>';
$output.= '<input type="password" name="password"/>';
$output.= '<div class="control">';
$output.= '<input type="submit" value="Login"/>';
$output.= '<input type="reset" value="Clear"/>';
$output.= '</div>';
$output.= '</form>';
}
else{
$output = '<p><strong>You are logged in as ' . $_SESSION['first_name'] . '</p>';
}

return $output;
}

}



/login.php

code:
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/c/global.php");

if($_SERVER['REQUEST_METHOD'] == 'POST'){
$username = $_POST['username'];
$password = $_POST['password'];

if(login->do_login($username,$password)){
//header("Location: http://192.168.20.33/");
echo "Login Sucessful";
}
else{
echo login->get_error();
}
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test 1</title>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
<style type="text/css" media="all">@import "/s/style01.css";</style>
</head>
<body>
<h1>You have failed to login.</h1>
<p>Click <a href="/index.php">Here</a> to try again.</p>
</body>
</html>



I think those are all the relevant bits and bobs, if I am missing something let me know.

Dan @ Code Town

(Edited by WarMage on 12-01-2004 17:08)

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 12-01-2004 17:51

I certainly wouldn't have the faintest idea, but you say you started using require_once instea of include - have you tried swapping include back in to see if there is any difference?

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 12-01-2004 19:09

Changing to using include didn't solve the issue.

http://codetown.org/work/phpinfo.html

Here is the PHPINFO maybe that would be of more help? I am just really stumped. I am pretty sure that it is an error that is causing the page to not be displayed, because if I comment out large blocks of code the page will show up again.

So the problem is that it is an error causing this but I am not getting the error warnings.

I don't know how to fix the issues without the warnings... it is a chicken and egg situation only nothing is being created. Any help would help, I am just stuck...

Dan @ Code Town

DmS
Maniac (V) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 12-01-2004 19:59

Looking at the phpinfo() this stands out (under php core, 15'th row);
display_errors
Off
Off
It's set to On in my config

Also, this I've never seen, on the other hand I don't know what it's supposed to say:
error_reporting
2047
2047
It's without value in my config.

Your setup is set to log errors, have you looked in the errorlog to see if anything ends up there?

/Dan

{cell 260} {Blog}
-{ ?Computer games don?t affect kids; I mean if Pac-Man affected us as kids, we?d all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music.? (Kristian Wilson, Nintendo, Inc, 1989.) }-

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 12-01-2004 20:27

Dan!!! Your a genious! Thanks for catching that. I now know how messed up the code actually is, I never throught that would be a relief.

Thanks all!

Dan @ Code Town

DmS
Maniac (V) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 12-01-2004 20:41

Cool, glad it helped!
but genius... nah, you would have seen it sooner or later
Now make sure you know why that flag got set to Off since you said it just stopped.

We actually have a similar situation at work, we have intentionally turned off display_errors and the developers keep the developments tail -f php_error_log running in a console during development.

Then for the live site we are getting 2 wallmounted 42" screens in the dev-room that will display the tail of the errorlog color coded for severity and type of error in order to catch and act on live errors instantly. It's needed since we have 8-10k simultaneus users running the site at peaks

And that's really cool I know
/Dan

{cell 260} {Blog}
-{ ?Computer games don?t affect kids; I mean if Pac-Man affected us as kids, we?d all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music.? (Kristian Wilson, Nintendo, Inc, 1989.) }-

(Edited by DmS on 12-01-2004 20:46)

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 12-02-2004 05:15

I do know why... and I feel dumb, I copied over the release php ini file last week. It was good because it got pear working, bad this week because it made errors not work.

That setup does sound pretty neat. Got any pics?

Dan @ Code Town

« BackwardsOnwards »

Show Forum Drop Down Menu