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 provides a ready-to-use Redis cloud solution that delivers numerous advantages, including:
- Redis Commander web interface included.
- Unlimited message size and transfers.
- One-click simplified updates.
- Optimal performance and enhanced security thanks to a private, dedicated infrastructure.
Save time and make your life easier: 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()
?>