-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
41 lines (32 loc) · 910 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
try {
runMariaDbQuery();
echo '<br>';
runRedisChecking();
phpinfo();
} catch (PDOException $e) {
echo "¡Error!: " . $e->getMessage() . "<br/>";
die();
}
function runMariaDbQuery() {
$pdo = new PDO('mysql:host=docker_nfs_mariadb;dbname=nfs', 'nfs', 'nfs');
$now = date('YmdHis');
$name = 'user_' . $now;
$value = $now;
$sql = "DELETE FROM `user`";
$pdo->prepare($sql)->execute();
$sql = "INSERT INTO `user` (`name`, `value`) values ('$name', '$value')";
$pdo->prepare($sql)->execute();
foreach($pdo->query('SELECT * from `user`') as $row) {
print_r($row);
}
$pdo = null;
}
function runRedisChecking()
{
$redis = new Redis();
$redis->connect('docker_nfs_redis', 6379);
echo "Connection to server sucessfully";
//check whether server is running or not
echo "Server is running: " . $redis->ping();
}