Re: undef func - any more clues ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

[root@jim ~]# 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.
[root@jim ~]$ 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)
[root@jim ~]# 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
[root@jim ~]# updatedb

Search for the recently installed package
[root@jim ~]# 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...
[root@jim ~]# 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.

[root@jim 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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux