Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

Fixing session_start(): Permission Denied (13) in XAMPP — System Administrator's Guide

3 min read
25.12.2025

What Does This Error Mean?

The error occurs when PHP cannot access the session storage directory (/applications/xampp/xamppfiles/temp/) due to permission issues, incorrect ownership, or configuration errors.

XAMPP session_start Permission Denied
XAMPP — its own tmp dir; verify owner matches the XAMPP daemon user.

For related session_start permission topics, see Fixing session_start() failed: Permission denied (13), Failed to Read Session Data (read-side), and XAMPP — SELinux/AppArmor restrictions variant.

Common Causes:

  1. Incorrect permissions on the session directory (/applications/xampp/xamppfiles/temp/).
  2. Wrong ownership (Apache/Nginx cannot write session files).
  3. Misconfigured php.ini session path.
  4. Session directory missing or corrupt session files.
  5. SELinux or security restrictions preventing access (Linux/macOS).

Find the PHP Session Directory

Check PHP Session Path in XAMPP

Run:

php -i | grep "session.save_path"

Expected output:

session.save_path => /applications/xampp/xamppfiles/temp

If the session path is empty, it means PHP is using the system's default temporary folder (/tmp).

Ensure the Session Directory Exists

If the session directory is missing, create it.

sudo mkdir -p /applications/xampp/xamppfiles/temp
Linux VDS
High performance for your projects
  • Root access and flexible setup
  • Control panel
  • NVMe disks
  • DDR5
Linux VDS

Fix Directory Permissions

Grant Read/Write Permissions to the Web Server

Set correct permissions so Apache/Nginx can write session files:

sudo chmod -R 770 /applications/xampp/xamppfiles/temp

Set Correct Ownership

For Apache (default user daemon on macOS XAMPP):

sudo chown -R daemon:daemon /applications/xampp/xamppfiles/temp

For Linux (Ubuntu/Debian/Arch), if running XAMPP manually:

sudo chown -R www-data:www-data /applications/xampp/xamppfiles/temp

Restart XAMPP and test again:

sudo /Applications/XAMPP/xampp restart

Verify php.ini Configuration

If PHP is using the wrong session path, update php.ini.

Locate php.ini in XAMPP

For macOS:

sudo nano /Applications/XAMPP/xamppfiles/etc/php.ini

For Linux:

sudo nano /opt/lampp/etc/php.ini

Update Session Settings

Find and modify:

session.save_handler = files
session.save_path = "/applications/xampp/xamppfiles/temp"
session.gc_maxlifetime = 3600
session.use_strict_mode = 1
session.cookie_secure = 0

If /applications/xampp/xamppfiles/temp is restricted, use /tmp/php_sessions instead.

Restart XAMPP

sudo /Applications/XAMPP/xampp restart

Clear Old or Corrupt Session Files

Corrupt session files can prevent new ones from being created.

sudo rm -rf /applications/xampp/xamppfiles/temp/*

Try running the session script again.

Debug with Error Logs

If the problem persists, check logs.

Check XAMPP Logs

sudo tail -f /Applications/XAMPP/logs/php_error_log

Check Apache Logs

sudo tail -f /Applications/XAMPP/logs/error_log

Summary of Fixes

Issue Fix
Session directory missing mkdir -p /applications/xampp/xamppfiles/temp
Incorrect folder permissions chmod -R 770 /applications/xampp/xamppfiles/temp
Wrong ownership chown -R daemon:daemon /applications/xampp/xamppfiles/temp
Misconfigured php.ini Update session.save_path
Corrupt session files rm -rf /applications/xampp/xamppfiles/temp/*

By following these systematic fixes, you can resolve session_start() permission errors in XAMPP and restore PHP session functionality.

Frequently asked questions
Linux: `/opt/lampp/tmp`. Windows: `C:\xampp\tmp`. macOS: `/Applications/XAMPP/tmp` or via xamppfiles. Verify in xampp/php/php.ini under session.save_path — may be empty (defaulting to /tmp) or set to an explicit XAMPP path. Don't assume; check.
`/opt/lampp/lampp start` runs as root by default but spawns httpd as user `daemon`. Session files end up owned by `daemon`. If you copy session files in/out from your user account, owner mismatch causes Permission Denied. Fix: `chown -R daemon:daemon /opt/lampp/tmp/`.
Windows uses file ACLs, not Unix modes. Right-click xampp/tmp → Properties → Security → Edit → ensure SYSTEM and Apache user (often "Everyone" in default XAMPP installs) have Full Control. Less granular than Unix but same principle.
Yes for dev. `rm /opt/lampp/tmp/sess_*` invalidates all current sessions — users logged in get logged out. Acceptable on local dev environment. Don't do this on production. After cleanup, retry the page that triggered the error; fresh session_start should work if perms are right.
Related articles
Fixing session_start(): No Such File or Directory Error in PHP
Fixing session_start() failed: Permission denied (13) — A System Administrator's Guide
Fixing session_start(): Permission Denied (13) — Failed to Read Session Data in PHP