Juanloz
Juanloz

Reputation: 17

Symfony 3 web module does not work

I've been trying to configure Symfony3 on Xampp on MacOS10.11.4.

The requirements checker sais my system is ready to run Symfony : requirements checker

I created a symfony project in the htdocs XAMPP folder. The server runs normally and I can open my project on the browser :

http://localhost/todolist/

When I try to get into the web folder, I get this error :

Fatal error: Uncaught RuntimeException: Session Storage was not able to create directory "/Applications/XAMPP/xamppfiles/htdocs/todolist/app/../var/sessions/prod" in /Applications/XAMPP/xamppfiles/htdocs/todolist/var/cache/prod/classes.php:292 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/todolist/var/cache/prod/appProdProjectContainer.php(1898): Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler->__construct('/Applications/X...') #1 /Applications/XAMPP/xamppfiles/htdocs/todolist/var/bootstrap.php.cache(2107): appProdProjectContainer->getSession_HandlerService() #2 /Applications/XAMPP/xamppfiles/htdocs/todolist/var/cache/prod/appProdProjectContainer.php(1937): Symfony\Component\DependencyInjection\Container->get('session.handler') #3 /Applications/XAMPP/xamppfiles/htdocs/todolist/var/bootstrap.php.cache(2107): appProdProjectContainer->getSession_Storage_NativeService() #4 /Applications/XAMPP/xamppfiles/htdocs/todolist/var/cache/prod/appProdProjectContainer.php(1885): Symfony\Componen in /Applications/XAMPP/xamppfiles/htdocs/todolist/var/cache/prod/classes.php on line 292

I've tried many things (changing permissions) but I'm still having the same problem.

Does anyone have some idea to fix this problem ?

Thanx in advance !

Upvotes: 2

Views: 1562

Answers (1)

Mohammad Zare Moghadam
Mohammad Zare Moghadam

Reputation: 688

It is because symfony save sessions on ./app/cache directory. Run these commands:

sudo rm -rf ./app/cache/*
HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx|lampp|xampp' | grep -v root | head -1 | cut -d\  -f1 PHPSTORMUSER=ps axo user,comm | grep -E 'storm' | grep -v root | head -1 | cut -d\  -f1`
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs

Upvotes: 2

Related Questions