I am using Debian. I have unixODBC installed as well as FreeTDS. I am using PHP
I have read several How-Tos and am stuck on a problem.
I tested FreeTDS by using tsql and it works.
I tested unixODBC by using isql and it works.
When I created a script in PHP and tried to access a database I get the following errors.
Fatal error: Call to undefined function odbc_connect()
I have found multiple php.ini files. Which is the one that Apache2 uses? Is there something in there that needs to be set.
Is there some setting that I missed seting that was not in the How-Tos?
All help is greatly appreciated.
You may need to provide environment variables to point to the location of your ODBC configuration files:
<?php
putenv("FREETDSCONF=/etc/freetds/freetds.conf");
putenv("ODBCSYSINI=/etc/odbcinst.ini");
putenv("ODBCINI=/etc/odbc.ini");
This works for me to connect to several ODBC databases. (Your config files might be somewhere else)
You need to install php5-mssql
and/or php5-odbc
.
I'd recommend you to install both just for sure.
Files from /etc/php5/conf.d/
and /etc/php5/apache2/php.ini
used to store PHP configuration options in Debian.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With