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

Posted on 2006-03-25
Last Modified: 2013-12-12
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:

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.
Question by:bsg999
    LVL 28

    Expert Comment

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


    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.


    Author Comment

    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.
    LVL 28

    Accepted Solution

    Did you compile php with ODBC support?


    Author Comment

    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?
    LVL 28

    Expert Comment

    Yes, i think it's worth it.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    This is a general how to create your own custom plugin system for your PHP application that you designed (or wish to extend a third party program to have plugin functionality that doesn't have it yet).  This is not how to make plugins for existing s…
    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now