apache segfaults if you bind This works for the simple query you have in your post but if you do anything more complicated odbc will segfault apache. For instance: <?php try { $db = new PDO('odbc:Driver=FreeTDS; Server=hostname_or_ip; Port=port; Database=database_name; UID=username; PWD=password;'); } catch(PDOException $exception) { die("Unable to open database.Error message: $exception."); } echo 'Successfully connected!'; $query = 'SELECT * FROM table_name WHERE table_name.COLUMN = ?'; $statement = $db->prepare($query); $statement->bindValue(1, 'Value', PDO::PARAM_STR); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_NUM); ?> /var/log/apache/error.log: [Fri Sep 03 07:30:03 2010] [notice] child pid 4007 exit signal Segmentation fault (11) Better to use pdo_dblib. Just make sure to set a DateTime compatible date format in /etc/freetds/locales.conf Reply
This works for the simple query you have in your post but if you do anything more complicated odbc will segfault apache.
For instance:
<?php
try
{
$db = new PDO('odbc:Driver=FreeTDS; Server=hostname_or_ip; Port=port; Database=database_name; UID=username; PWD=password;');
}
catch(PDOException $exception)
{
die("Unable to open database.
Error message:
$exception.");
}
echo 'Successfully connected!';
$query = 'SELECT * FROM table_name WHERE table_name.COLUMN = ?';
$statement = $db->prepare($query);
$statement->bindValue(1, 'Value', PDO::PARAM_STR);
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_NUM);
?>
/var/log/apache/error.log:
[Fri Sep 03 07:30:03 2010] [notice] child pid 4007 exit signal Segmentation fault (11)
Better to use pdo_dblib. Just make sure to set a DateTime compatible date format in /etc/freetds/locales.conf