OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 14 May 2013 01:29:29 -0000 Issue 8230

php-general-digest-helplists.php.net
Date: Mon May 13 2013 - 20:29:29 CDT


php-general Digest 14 May 2013 01:29:29 -0000 Issue 8230

Topics (messages 321078 through 321078):

Re: undef func - any more clues ?
        321078 by: Jim Lucas

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


On 05/12/2013 10:34 AM, georg wrote:
> Hi
> Im not really following, I have done:
> pecl list-all ; but dont find anything that has to do with ODBC
>
> so still stuck with Apache error log saying : no such function (or eqiv
> speak) odbc_connect()
> tnx
> Georg

I am using a CentOS 6.4 system as a work station. So, with that said,
the systems are similar, but still different enough that you need to
make a few changes regarding the package names to get things working.

I also have Apache installed the I develop with. These are the steps
that I performed, and the order I performed them in, to get odbc working
at the CLI and with Apache.

Here first is an example of what I got when trying to call
odbc_connect() without the proper packages installed from the CLI.

[rootjim ~]# php -r "odbc_connect();"
PHP Fatal error: Call to undefined function odbc_connect() in Command
line code on line 1

Fatal error: Call to undefined function odbc_connect() in Command line
code on line 1

Search for the correct package.
[rootjim ~]$ yum list php* | grep -i odbc
php-odbc.x86_64 5.3.3-22.el6 base

Install found package... (change the package name if needed)
[rootjim ~]# yum install php-odbc

...

Total download size: 428 k
Installed size: 1.2 M
Is this ok [y/N]: y

...

Running Transaction
   Installing : unixODBC-2.2.14-12.el6_3.x86_64 1/2
   Installing : php-odbc-5.3.3-22.el6.x86_64 2/2
   Verifying : php-odbc-5.3.3-22.el6.x86_64 1/2
   Verifying : unixODBC-2.2.14-12.el6_3.x86_64 2/2

Installed:
   php-odbc.x86_64 0:5.3.3-22.el6

Dependency Installed:
   unixODBC.x86_64 0:2.2.14-12.el6_3

Complete!

Update your locate database
[rootjim ~]# updatedb

Search for the recently installed package
[rootjim ~]# locate odbc.so | grep php
/usr/lib64/php/modules/odbc.so
/usr/lib64/php/modules/pdo_odbc.so

Re-run the first test - ah it is found...
[rootjim ~]# php -r "odbc_connect();"
PHP Warning: odbc_connect() expects at least 3 parameters, 0 given in
Command line code on line 1

Warning: odbc_connect() expects at least 3 parameters, 0 given in
Command line code on line 1

Once you have this, you know that everything in place to get it working
with Apache.

Now to test in the web server. This is what I received when I viewed my
test script via Apache and my browser.

URL: http://localhost/odbc_test.php

Fatal error: Call to undefined function odbc_connect() in
/var/www/html/odbc_test.php on line 3

Now, to get it working with Apache, all I had to do was restart the web
server.

[rootjim html]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

Now, refreshing the above page gives me this.

Warning: odbc_connect() expects at least 3 parameters, 0 given in
/var/www/html/odbc_test.php on line 3

So, it is now working.

Review my steps above, make sure you perform them as I did and you
should be working when you are done.

Let us know if you need anything further.

--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/