#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    15
    Rep Power
    0

    PHP with UnixODBC


    I have compiled and installed Apache, PHP, and UnixODBC on QNX Neutrino 6.2.1. The database I am using is Empress. Apache and PHP are working together. UnixODBC is working as I have tested it with iSQL and successfully connected to the Empress database. I have built PHP with UnixODBC. When I use PHP from the command line, PHP connects successfully to the Empress database using UnixODBC. However, when I build PHP with UnixODBC, restart Apache, and open the PHP script in a browser, I get an error ...

    Warning: odbc_pconnect(): SQL error: [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_DBC failed, SQL state IM005 in SQLConnect in /usr/local/apache_1.3.27/share/apache/htdocs/ test.php on line 3

    It seems there is only an error connecting to the database when trying to connect from Apache using PHP with UnixODBC. UnixODBC works, PHP with UnixODBC works from command line, but as soon as Apache is included in the mix, I get the above error.

    Why would this happen?

    Thanks.
  2. #2
  3. Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    449
    Rep Power
    0
    Could it be because when you run php yourself.. you're executing commands as root... but when apaches does it, it is executing the commands as the apache user?
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    15
    Rep Power
    0
    Thank you for your response.

    I can actually execute PHP commands as users other than root. For example, I have a user called "quimby" in the group called "quimby". This user can execute PHP commands and connect to a remote database using unixODBC.

    I have tried changing the Apache user and group to quimby/quimby, but this doen't work. I have tried changing the ownership of the driver to the Apache user, but this doesn't work.I have tried changing the permissions of the driver to give other users r,w,x (o=rwx), but this doesn't work.

    Any other suggestions? I appreciate it.

IMN logo majestic logo threadwatch logo seochat tools logo