Created
December 23, 2015 04:47
-
-
Save Matthew-Learnosity/98c0ee5588186b12fe29 to your computer and use it in GitHub Desktop.
Simple PHP script to query AWS RDS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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