Skip to content

Instantly share code, notes, and snippets.

@Matthew-Learnosity
Created December 23, 2015 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Matthew-Learnosity/98c0ee5588186b12fe29 to your computer and use it in GitHub Desktop.
Save Matthew-Learnosity/98c0ee5588186b12fe29 to your computer and use it in GitHub Desktop.
Simple PHP script to query AWS RDS
#!/usr/bin/php
<?php
echo '***** Fail over test starting up', PHP_EOL;
ini_set("default_socket_timeout", 2);
$dbh = new PDO(
'mysql:host=hostname',
'username',
'password'
);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbh->setAttribute(PDO::ATTR_PERSISTENT, false);
$dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$count = 0;
while (true) {
echo '* running query ' . ++$count . ' times';
$dbh->query('SELECT NOW() FROM dual');
echo " - done", PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment