Re: Problems with require_once() and directory structure
- From: "Johnny" <removethis.huuanito@xxxxxxxxxxx>
- Date: Thu, 28 Sep 2006 10:08:14 -0700
"Bit Byte" <root@xxxxxxxxxxx> wrote in message
news:abOdnRyTD4nrVYbYRVnyug@xxxxxxxxx
I have written a number of PHP include files. I have carefullyso MySQLDatabase is a class you wrote and is defined in
partitioned them into logical folders - based on functionality. My
directory structure looks something like this:
$(rootdir)/includes/
$(rootdir)/includes/patterns
$(rootdir)/includes/core/db
$(rootdir)/includes/core/utils
$(rootdir)/includes/core/logger
...
etc.
Each folder contains one or more files. I wrote the following script to
test my db classes:
<?php
echo "In script\n" ;
include ("/db/mysql_database.inc.php");
echo "Got here\n" ;
try
{
echo "Attempting to instantiate db object\n" ;
$m_dbconnection = new MySQLDatabase();
echo "Object created succesfully\n" ;
}
catch (Exception $e)
{
echo "Exception caught : " . $e->getMessage() . "\n" ;
}
?>
Output: "In script Got here Attempting to instantiate db object "
I cannot, for the life of me, work out wtf is wrong iwth the script, and
why I can't seem to use my directory structure. The above script is
being run from $(rootdir). $(rootdir) is in folder htdocs under Apache.
Additional Info:
----------------------
PHP Version: PHP5
Web Server: Apache 2.0
OS: Windows 2K
/db/mysql_database.inc.php?
what's not clear is how you are connecting to mysql inside that class, how
it gets usernames,passwords, etc for access.
usually to make the class general you would pass host,user,password to it at
instantiation but you might be doing that some other way...
does your class generate an exception on failure to connect to the db?
it's not clear from what you disclose that your file structure has anything
to do with the failure.
another thing that's not clear is what require_once has to do with all this,
you mention in the subject line but no more....
might be time to put some debug statements in your db include body and in
the class itself to see where it's getting to.
.
- References:
- Problems with require_once() and directory structure
- From: Bit Byte
- Problems with require_once() and directory structure
- Prev by Date: Re: $php_errormsg is blank after fopen
- Next by Date: Re: $php_errormsg is blank after fopen
- Previous by thread: Problems with require_once() and directory structure
- Index(es):
Relevant Pages
|
|