PHP Stops With No Error Message
Posted: Thu Jul 01, 2010 11:22 am
I am baffled as to how to debug a case where PHP simply stops interpreting a page with no error message.
In the main page I have:
The first print statement is executed. The second is not.
The referenced file contains:
And just to reassure you that the file in question is where I told PHP to look for it:
PHP seems to simply stop dead when it comes to that require_once statement.
How do I figure out what the problem is?
In the main page I have:
Code: Select all
...
require_once "/home/jcobban/includes/legacyAddress.inc";
print "<p>require_once '/home/jcobban/includes/legacyHeader.inc'";
require_once "/home/jcobban/includes/legacyHeader.inc";
print "<p>about to open a database connection</p>\n";
...
The referenced file contains:
Code: Select all
<?php
/**
* legacyHeader.inc
*
* Definition of a class representing a header entry in a genealogical
* database as implemented by Legacy 7 Family Tree. This class provides
* access to the information in the table tblHR.
*
* Copyright © 2010 James A. Cobban
*
**/
/**
* legacyHeader
*
* Definition of a class implementing behavior for header entry records
* within a genealogy database as implemented by Legacy 7 Family Tree.
*
**/
class legacyHeader
{
/**
* legacyHeader::table
*
* Associative array containing all key/value pairs in header.
**/
private table;
/**
* legacyHeader::__construct
*
* Given the identifier extract information about a header entry.
*
* Input:
* $conn connection resource to database
*
* Returns object containing header record.
**/
function __construct($conn)
{
// construct the query of the header table
$query = "SELECT Item, Setting FROM tblHR;";
// query the database
print "<p>$query</p>";
$this->connection->setFetchMode(MDB2_FETCHMODE_ASSOC);
$result = doQuery($this->connection,
$query);
$this->table = array();
while(($dbrow = $result->fetchRow()) != null)
{ // copy all entries into table
$this->table[$dbrow['item']] = $dbrow['setting'];
} // copy all entries into table
} // legacyHeader::__construct
/**
* legacyHeader::getSetting
*
* Get the setting value corresponding to an item name.
**/
function getSetting($item)
{
// action depends upon type of first parameter
if (is_string($item))
{ // numeric identifier of record
return $this->table[$item];
} // item name
else
{
print "<p class='message'>legacyHeader::getSetting: called with " .
gettype($item) . "<\p>\n";
return '';
}
} // legacyHeader::getItem
/**
* legacyHeader::getKeys
*
* Get an array containing all of the keys in the header.
**/
function getKeys()
{
$retval = array();
$i = 0;
foreach($this->table as $key => $value)
{
$retval[$i] = $key;
$i++;
} // loop through all elements in table
} // legacyHeader::getItem
} // class legacyHeader
?>
Code: Select all
$ ls -l /home/jcobban/includes/*.inc
-rw-rw-rw- 1 jcobban jcobban 529 2010-05-01 22:34 /home/jcobban/includes/db.inc
-rw-rw-rw- 1 jcobban jcobban 523 2010-04-12 15:36 /home/jcobban/includes/dbIsp.inc
-rw-r--r-- 1 jcobban jcobban 13515 2010-06-29 21:18 /home/jcobban/includes/formUtil.inc
-rw-r--r-- 1 jcobban jcobban 4535 2010-05-24 00:48 /home/jcobban/includes/legacyAddress.inc
-rw-r--r-- 1 jcobban jcobban 7255 2010-05-28 00:21 /home/jcobban/includes/legacyCitation.inc
-rw-r--r-- 1 jcobban jcobban 4404 2010-06-03 17:25 /home/jcobban/includes/legacyFamily.inc
-rw-r--r-- 1 jcobban jcobban 2232 2010-07-01 12:03 /home/jcobban/includes/legacyHeader.inc
-rw-r--r-- 1 jcobban jcobban 12117 2010-06-11 05:13 /home/jcobban/includes/legacy.inc
-rw-r--r-- 1 jcobban jcobban 17848 2010-06-20 13:44 /home/jcobban/includes/legacyIndiv.inc
-rw-r--r-- 1 jcobban jcobban 3990 2010-06-11 04:23 /home/jcobban/includes/legacyLocation.inc
-rw-r--r-- 1 jcobban jcobban 1725 2010-05-22 10:52 /home/jcobban/includes/legacyRecord.inc
-rw-r--r-- 1 jcobban jcobban 3889 2010-05-24 00:51 /home/jcobban/includes/legacySource.inc
How do I figure out what the problem is?