[thelist] [php] Fatal error: Call to a member function on a non-object
Burhan Khalid
thelist at meidomus.com
Wed Dec 22 05:15:13 CST 2004
Tim Burgan wrote:
> Hello,
>
>
> I have a database driven (MS Access 2000) PHP website that runs fine on
> my localhost (Apache, WinXP), but when I upload it to the web host (IIS)
> and try to access a page I receive the following error:
>
> Fatal error: Call to a member function on a non-object in
> c:\XXX\inc\dbConnOpen.php on line 17
>
> The file in question contains code that forms a connection to the
> database. I've used this EXACT same code on this same website for the
> last 8 months with no problem.. then when I upload the WHOLE site
> again.. it doesn't work.
>
> Here's the contents of the above file:
>
> /* Open database connection */
> $db_connection = new COM("ADODB.Connection") or die("Cannot start ADO");
> $db_connstr = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" .
> realpath("directory/database.mdb") . ";DefaultDir=" .
> realpath("directory");
> $db_connection->open($db_connstr); // THIS IS LINE 17
>
>
> Can anyone shed some light onto what this error means in plain english,
> and possible what I can do.
1. Check if PHP versions match
2. Check if there were any problems with permissions
The error means that $db_connection was not an object of the COM class
(in other words, it couldn't create the ADODB com object).
Do a print_r($db_connection) to find out what it is.
More information about the thelist
mailing list