PHP Session Permission denied on Httpd Windows with Symfony

  apache, php, symfony, windows

I have a local PHP and Apache Httpd (with mod-php enabled) installation running on Windows.

The PHP-Application uses Symfony and stores the PHP-Sessions inside the project directory.

The Httpd-Server runs (as usual on Windows) as System-Service, so with all permissions on each directory.

As far as I understand, PHP runs with the same permissions as the Httpd-Server because it is invoked with mod-php and inherits the permissions.

When accessing the application i receive the following error message:

Warning: SessionHandler::read(): open(C:Apache24htdocscrmsymfony-appvarsessionsdevsess_k0hlrje0nktcraj5sd96gdgi9g, O_RDWR) failed: Permission denied (13)

However I don’t understand why this happens, the file shown in the error has full SYSTEM-Permissions and the symfony/var directory has full System-Permissions too.

Also the session-files that need to be read when the error occurs are always empty.

https://i.stack.imgur.com/VjKH4.png

Here is the symfony session configuration

https://i.stack.imgur.com/JlKre.png

We are currently running the application in dev-environment.
We already tried to remove all sessions and empty the symfony-cache via cache:clear but to no avail.

I already researched a lot, but this error only ever appears on Linux or Windows with IIS instead of Apache-Httpd. On Linux and IIS the solution usually is to set the user that executes the HTTPD/IIS-server as owner of the directory containing the sessions. However httpd runs as System-User per default which does not require those steps.

Any help is appreciated!

Source: Symfony Questions

LEAVE A COMMENT