Redis®*: Handle PHP sessions with Redis
This documentation is part of the Getting started guide. You can view the complete guide here: Quick guide to getting started with Redis.
👋 Welcome to the Stackhero documentation!
Stackhero offers a ready-to-use Redis cloud solution that provides numerous benefits, including:
Redis Commanderweb UI included.- Unlimited message size and transfers.
- Simplified updates with just a click.
- Optimal performance and enhanced security powered by a private and dedicated VM.
Save time and simplify your life: it only takes 5 minutes to try Stackhero's Redis cloud hosting solution!
If you would like to store PHP sessions on Stackhero for Redis, you can use the following example:
<?php
// Parse Redis URL
$redis_url = parse_url("rediss://default:<yourPassword>@<XXXXXX>.stackhero-network.com:<PORT_TLS>")
// Configure session handler
ini_set("session.save_handler", "redis")
ini_set("session.save_path", "tls://{$redis_url["host"]}:{$redis_url["port"]}?auth={$redis_url["pass"]}&timeout=5")
// Start the session
session_start()
?>