我有一个简单的路由来测试与Microsoft SQL Server的数据库连接:
Route::get('/', function()
{
$db = DB::Connection("sams")->getPdo();
$stmt = $db->prepare("SELECT 1");
$stmt->execute();
while($row = $stmt->fetch()) {
echo
print_r($row);
}
var_dump($db);
});
我在Fedora 20上,使用unixODBC和FreeTDS连接到数据库。这是我正在运行的事物的版本(包版本):
php.x86_64 5.5.7-1.fc20 @updates
php-bcmath.x86_64 5.5.7-1.fc20 @updates
php-cli.x86_64 5.5.7-1.fc20 @updates
php-common.x86_64 5.5.7-1.fc20 @updates
php-devel.x86_64 5.5.7-1.fc20 @updates
php-gd.x86_64 5.5.7-1.fc20 @updates
php-mcrypt.x86_64 5.5.7-1.fc20 @updates
php-mssql.x86_64 5.5.7-1.fc20 @updates
php-odbc.x86_64 5.5.7-1.fc20 @updates
php-pdo.x86_64 5.5.7-1.fc20 @updates
php-pear.noarch 1:1.9.4-23.fc20 @fedora
php-pecl-jsonc.x86_64 1.3.3-1.fc20 @updates
php-pecl-jsonc-devel.x86_64 1.3.3-1.fc20 @updates
php-process.x86_64 5.5.7-1.fc20 @updates
php-xml.x86_64 5.5.7-1.fc20 @updates
freetds.x86_64 0.91-9.gitb760a89.fc20 @fedora
freetds-devel.x86_64 0.91-9.gitb760a89.fc20 @fedora
unixODBC.x86_64 2.3.2-2.fc20 @fedora
unixODBC-devel.x86_64 2.3.2-2.fc20 @fedora
这是我的odbc.ini(混淆):
[SAMS]
Driver = TDS
Description = SAMS Database
Servername = {Servername}
Port = {Port}
Password = {password}
ODBCINST.INI:
[TDS]
Description = FreeTDS.org
Driver = /usr/lib64/libtdsodbc.so
Setup = /usr/lib64/libtdsS.so
FileUsage = 1
freetds.conf:
[SAMS]
Trace = Yes
TraceFile = /home/njones/sql.log
ForceTrace = Yes
host = {ipaddress}
port = {port}
tds version = 8.0
但是,当我在Laravel Development Server中测试时,我收到以下错误。
*** stack smashing detected ***: /usr/bin/php terminated