By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,592 Members | 1,931 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,592 IT Pros & Developers. It's quick & easy.

Problem with php & com objects on hosting provider

P: n/a
Ray
Hi

I need to access an access db via php.

My hosting provider is using php version 4.3.10 on a windows 2003 platform.
I think that php was installed with the Plesk for windows package/control
panel.

The scripts work on my dev box (winxp with iis5) but yet when I upload the
scripts to my hosting provider I get the following error

*Fatal error*: Call to a member function on a non-object in
*C:\xxx\xxx\xxxx\httpdocs\test.php* on line *12*

This error comes up when I call the database connection. I tried 2 different
connection strings including setting up and using an obdc connection both a
user and a system dsn connection but with no luck...

I am using standard php functions to connect...

Sample::

$db = realpath("./data/mydatabase.mdb");

$conn = new COM("ADODB.Connection");
$rs = new COM("ADODB.Recordset");
$dsn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" .$db.";User
Id=ddd;Password=xxx;" ;
//$dsn = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" .$db;
//$dsn="DSN = Prop"; $conn->Open($dsn);
$rs = $conn->Execute("select * from mytable");

The 3 different connection strings are defined under the $dsn variable...

Has anyone else had a similar problem to this or got a solution..

It almost sounds like php can't call on a com object...

My hosting provider can't seem to find a solution...

Any suggestions will be greatly appreciated...
Thanks
Ray
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Ray wrote:
Hi

I need to access an access db via php.

My hosting provider is using php version 4.3.10 on a windows 2003 platform.
I think that php was installed with the Plesk for windows package/control
panel.

The scripts work on my dev box (winxp with iis5) but yet when I upload the
scripts to my hosting provider I get the following error

*Fatal error*: Call to a member function on a non-object in
*C:\xxx\xxx\xxxx\httpdocs\test.php* on line *12*

This error comes up when I call the database connection. I tried 2 different
connection strings including setting up and using an obdc connection both a
user and a system dsn connection but with no luck...

I am using standard php functions to connect...

Sample::

$db = realpath("./data/mydatabase.mdb");

$conn = new COM("ADODB.Connection");
$rs = new COM("ADODB.Recordset");
$dsn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" .$db.";User
Id=ddd;Password=xxx;" ;
//$dsn = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" .$db;
//$dsn="DSN = Prop"; $conn->Open($dsn);
$rs = $conn->Execute("select * from mytable");

The 3 different connection strings are defined under the $dsn variable...

Has anyone else had a similar problem to this or got a solution..

It almost sounds like php can't call on a com object...

My hosting provider can't seem to find a solution...

Any suggestions will be greatly appreciated...
Thanks
Ray

Ray,
Assuming your hosting provider supports a DBMS other than Access
I suggest that you look into switching instead of fighting.

Access is an excellent product -- but not on a server! Since,
based on your example, you are familiar with SQL you would be
better off using a server product such as MS Sql Server or MySQL.

HTH
Jerry
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.