Link to home
Create AccountLog in
Avatar of bsg999
bsg999Flag for United States of America

asked on

Fatal error: Call to undefined function using ODBC on a Red Hat Enterprise 4 Server

We are trying to set up PHP/Apache on a Red Hat Enterprise 4 server to connect via ODBC to a Progress V10 database on an AIX server.  I can successfully run a PHP test page from the command line and get successful results.  When I run the same page through the browser I get the following error in the Apache log:

[client x.x.x.x] PHP Fatal error:  Call to undefined function:  
odbc_connect() in /var/www/html/bgtest2.php on line 15

Versions we are running:
php-4.3.9-3.8
php-mysql-4.3.9-3.8
php-pear-4.3.9-3.8
php-odbc-4.3.9-3.8
httpd-2.0.52

We have compiled it with and without mySQL support.  Ideally, we would like to connect to both mySQL and Progress but I can work aound not having mySQL if that is an issue.

Any help would be greatly appreciated.
Avatar of gamebits
gamebits
Flag of Canada image

Make sure you define the connection parameter in the odbc_connect() function

From http://ca.php.net/odbc_connect


resource odbc_connect ( string dsn, string user, string password [, int cursor_type] )


Returns an ODBC connection id or 0 (FALSE) on error.

The connection id returned by this functions is needed by other ODBC functions. You can have multiple connections open at once as long as they either use different db or different credentials. The optional fourth parameter sets the type of cursor to be used for this connection. This parameter is not normally needed, but can be useful for working around problems with some ODBC drivers.

Gamebits
Avatar of bsg999

ASKER

The connection parameters are correct . I get sucessful results when I run "php /var/www/html/bgtest2.php" from the command line.  The error occrs when I attemp to load the page in the browser using the apache web server.
ASKER CERTIFIED SOLUTION
Avatar of gamebits
gamebits
Flag of Canada image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of bsg999

ASKER

Yes.  If there was a path problem or any other problem with the compile would it work from the command line?  I had first suspected a problem with the compile with ODBC support but the fact that it worked from the command line pointed me in a different direction.  I am using the Merant ODBC driver provided with Progress's SQL Client Access product.  Is it worth trying iodbc?
Yes, i think it's worth it.

Gamebits