SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | ||
3 | ini_set('session.save_handler', 'redis'); | |
4 | ini_set('session.save_path', 'tcp://localhost:6379'); | |
5 | ||
6 | session_name('FOOBAR'); | |
7 | session_start(); | |
8 | ||
9 | if (!array_key_exists('visit', $_SESSION)) { | |
10 | $_SESSION['visit'] = 0; | |
11 | } | |
12 | $_SESSION['visit']++; | |
13 | ||
14 | echo 'You have been here ' . $_SESSION['visit'] . ' times.'; | |
15 | ||
16 | /** | |
17 | * This produces an error: | |
18 | * Warning: session_start(): Failed to read session data: redis (path: tcp://localhost:6379) in session.php on line 7 | |
19 | */ |