# Warning: session_start(): open(/var/lib/php/sessions/sess_x, O_RDWR) failed: Permission denied

**Code:** `session save path` · **Category:** PHP · **Seen on:** PHP

PHP can’t write session files to the configured session.save_path.

## Meaning

The session directory must be writable by the PHP process user. After changing the PHP-FPM user, restoring from backup or using a custom save path, permissions often don’t match.

## Common causes

- save_path owned by another user
- Directory doesn’t exist
- Disk full
- SELinux context blocking writes

## Quick fix

1. Check `session.save_path` in phpinfo()
2. Make the directory writable by the PHP user
3. Use a path inside your app (e.g. storage/sessions) or a Redis session handler

## Detailed fix by platform

### Linux

1. `sudo chown -R www-data:www-data /var/lib/php/sessions && sudo chmod 1733 /var/lib/php/sessions`

## How to diagnose

1. **Path** — Which save path?
2. **Owner** — Who owns it vs which user runs PHP?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/php/session-save-path-permission-denied)
