summaryrefslogtreecommitdiff
path: root/linkshorter/db.php
diff options
context:
space:
mode:
Diffstat (limited to 'linkshorter/db.php')
-rw-r--r--linkshorter/db.php16
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>");
+}