Anonymous

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

Fri, 03/09/2010 - 14:36 Permalink

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <p> <br> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA