your code works for me on PHP 5.3.6 and mysqld 5.1.58 (it returns false and really uses cooks), try updating PHP to> = 5.3 to make sure this is a version problem (if so, then the update is probably , your only solution).
Despite the fact that even if you manage to set this flag, this does not mean that the PDO will use the prepared statement, if you want to check whether the PDO really uses cooks (and you can use wireshark ) you can write a simple script that prepared the request :
<?php $pdo = new PDO(..., array(ATTR::PDO_EMULATE_PREPARES => false)); $stmt = $pdo->prepare('SELECT :param'); $stmt->bindValue(':param', 5); $stmt->execute();
Fool the transmission until you find the query "SELECT: param" - if: param has been replaced by a question mark, then PDO uses cook. If it has been replaced by "5", then PDO emulates the finished ones.
source share