9951 explained code solutions for 126 technologies


php-pdoSet execution timeout with PHP PDO


$pdo = new PDO('mysql:host=localhost;dbname=test', 'usr', 'pwd', [
  PDO::ATTR_TIMEOUT => 90
]);ctrl + c
$pdo

PDO connection object

new PDO

create new PDO connection

PDO::ATTR_TIMEOUT

settings attribute that controls execution timeout

90

value in seconds for timeout