Problem with php & com objects on hosting provider

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ray

    Problem with php & com objects on hosting provider

    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\xxx x\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.Conn ection");
    $rs = new COM("ADODB.Reco rdset");
    $dsn = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" .$db.";User
    Id=ddd;Password =xxx;" ;
    //$dsn = "DRIVER={Micros oft Access Driver (*.mdb)};DBQ=" .$db;
    //$dsn="DSN = Prop"; $conn->Open($dsn);
    $rs = $conn->Execute("selec t * 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


  • jerry gitomer

    #2
    Re: Problem with php & com objects on hosting provider

    Ray wrote:[color=blue]
    > 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\xxx x\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.Conn ection");
    > $rs = new COM("ADODB.Reco rdset");
    > $dsn = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" .$db.";User
    > Id=ddd;Password =xxx;" ;
    > //$dsn = "DRIVER={Micros oft Access Driver (*.mdb)};DBQ=" .$db;
    > //$dsn="DSN = Prop"; $conn->Open($dsn);
    > $rs = $conn->Execute("selec t * 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
    >
    >[/color]
    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

    Comment

    Working...