我正尝试在 CentOS 6.7 上使用 Laravel(PHP 5.6)连接到Sybase服务器。
我已经安装了freetds
和unixODBC
:
sudo yum install freetds unixODBC
并设法在命令行中与tsql
连接:
TDSVER=5.0 tsql -H ServerName -p 1234 -U username
我配置了:
/etc/freetds.conf
[ServerName]
host = ServerName
port = 1234
tds version = 5.0
/etc/odbc.ini *请注意,libtdsodbc.so.0.0.0是我在/ usr / lib64中看到的文件
[ServerName]
Driver = /usr/lib64/libtdsodbc.so.0.0.0
Trace = No
Server = ServerName
Database = DBName
Port = 1234
TDS_Version = 5.0
当我与Laravel联系时,我尝试了:
$db = new \PDO("dblib:host=ServerName;port=1234;dbname=DBName", "UserName", "Pwd");
和
$db = new PDO('odbc:Driver=FreeTDS; Server=ServerName; Port=1234; Database=DBName; UID=UserName; PWD=Pwd;');
并且
't20fx' => [
'driver' => 'sqlsrv',
'host' => 'ServerName',
'port' => 1234,
'database' => 'DBName',
'username' => 'UserName',
'password' => 'Pwd',
'charset' => 'utf8',
'prefix' => '',
],
每次出现could not find driver
错误时......我怎么能将Laravel连接到Sybase(我讨厌这种旧技术......)??