diff options
| author | Horus3 | 2014-11-16 21:20:41 +0100 |
|---|---|---|
| committer | Horus3 | 2014-11-16 21:20:41 +0100 |
| commit | 4168f7aff52f6e7cf7320e42252227dac5169c4a (patch) | |
| tree | f73e5e93e8bc8d9b5ad8ef415b59ede323663f76 /linkshorter/db.php | |
| download | tools.iamfabulous.de-4168f7aff52f6e7cf7320e42252227dac5169c4a.tar.gz | |
Initial commit.
Diffstat (limited to 'linkshorter/db.php')
| -rw-r--r-- | linkshorter/db.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/linkshorter/db.php b/linkshorter/db.php new file mode 100644 index 0000000..4dcf58a --- /dev/null +++ b/linkshorter/db.php @@ -0,0 +1,16 @@ +<?php + +$db = new Redis(); +$db->connect('/var/run/redis/redis.sock'); + +try { + $db->ping(); +} catch (Exception $e){ + do_output("<p>No connection to the database established.</p>", "500 Server Failure", false, "<h1>Redis went away</h1>"); +} + +try { + $db->select(1); +} catch (Exception $e){ + do_output("<p>No connection to the database established.</p>", "500 Server Failure", false, "<h1>Redis went away</h1>"); +} |
