I am trying to get the pdo_odbc extension for PHP enabled on my Mac which is running PHP 5.3 Here is what i did to try to get it to work:
I installed UnixODBC with brew
$ brew install unixodbcDownloaded the source for PHP 5.3.8. In the terminal I navigated to the pdo_odbc folder. Then did the following.
$ phpize $ ./configure --with-pdo-odbc=unixODBC $ makeThere was an error.
/Users/todd/Downloads/php-5.3.8/ext/pdo_odbc/pdo_odbc.c:43: error: ‘ZEND_MOD_END’ undeclared here (not in a function) /Users/todd/Downloads/php-5.3.8/ext/pdo_odbc/pdo_odbc.c: In function ‘zm_startup_pdo_odbc’: /Users/todd/Downloads/php-5.3.8/ext/pdo_odbc/pdo_odbc.c:135: warning: cast to pointer from integer of different sizeBased on some blogs I replaced
ZEND_MOD_ENDwith{NULL,NUll, NULL}and ran make again. This time it complied.Then I ran "sudo make install" and that installed the extension in the right place. I modifed php.ini to enable it. And it shows up in phpInfo()
So far so good. But when I start running simple tests I get errors about every other try
php(20048,0x7fff796f1960) malloc: *** mmap(size=2977160837258543104) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
terminate called throwing an exceptionAbort trap: 6
This was thrown, when i tried to execute this code:
<?php
$dsn = 'odbc:Driver={FileMaker ODBC};Server=localhost;Database=CalDAV;';
$pdo = new PDO($dsn, "odbc", "odbc");
$sql = "SELECT * From Users Where id = 2";
$r = $pdo->query($sql);
print_r($r->fetch(PDO::FETCH_ASSOC));
$sql = "SELECT * From Users Where id = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute(array(2));
print_r($stmt->fetch(PDO::FETCH_ASSOC));
?>