Reputation: 21
I have installed freetds with unixODBC and when I test the connection with isql it works perfectly but when I try to make the connection with php I get an S1000 error.
my configuration details are I have a DSN in my freetds.conf
[MYDSN]
host = 192.168.30.233
port = 1433
tds version = 8.0
client charset = UTF-8
My odbc.ini file has
[MYDSN]
Driver = FreeTDS
Descrioption = conn unixodbc with FreeTDS
tds version = 8.0
Server = 192.168.30.233
Port = 1433
Database = mydb
client charset = UTF-8
my odbcinst file has
[FreeTDS]
Description = MSSQL Driver
Driver = /usr/lib64/libtdsodbc.so
UsageCount = 1
I used this tutorial to make the installation and I installed the drivers with odbcinst.
In order to connect with php I use the DSN connection and I tried with both odbc_connect and mssql_connect.
odbc_connect("MYDSN",$this->user,$this->password)
mssql_pconnect( "MYDSN",$this->user,$this->password)
i also tried with PDO with the following code
new \PDO ("dblib:host=MYDSN;dbname=mydb;",$this->user,$this->password);
With isql everything worked fine.
I am using Microsoft SQL Server 2008.
Does anyone know what may cause this problem . Thanks in advance
Upvotes: 2
Views: 1179
Reputation: 45500
This usually means that you are missing php odbc so install it
sudo apt-get install php5-odbc
Upvotes: 1