difficulties in running migrations

Member | 1

Hello guys, I'm trying to run the repository https://github.com/…ent-platform natively on my server, without using docker, and when running the migrations I got the answer

Nette\IOException: Unable to create file ‘/var/www/html/consent-management-platform/src/../var/cache/nette.configurator/Container_1aa4663c95.php.lock’. Failed to open stream: Permission denied in /var/www/html/consent-management-platform/vendor/nette/di/src/DI/ContainerLoader.php:71
#0 /var/www/html/consent-management-platform/vendor/nette/di/src/DI/ContainerLoader.php(44): Nette\DI\ContainerLoader->loadFile(‘…’, Array)
#1 /var/www/html/consent-management-platform/vendor/nette/bootstrap/src/Bootstrap/Configurator.php(271): Nette\DI\ContainerLoader->load(Array, Array)
#2 /var/www/html/consent-management-platform/vendor/nette/bootstrap/src/Bootstrap/Configurator.php(252): Nette\Bootstrap\Configurator->loadContainer()
#3 /var/www/html/consent-management-platform/bin/console(9): Nette\Bootstrap\Configurator->createContainer()
#4 {main}
Tracy is unable to log error: Unable to write to log file ‘/var/www/html/consent-management-platform/src/../var/log/exception.log’. Is directory writable?

I already changed the file permissions to chmod 777 but the error persists, reddis seems to be configured correctly, can anyone help me?

Marek Bartoš
Nette Blogger | 1069

Ideally you should upload your app and run all console command with a user that is in group www-data. Because www-data:www-data (user www-data in group www-data) is the one that will use the app via web server. You will then have no problems with permissions.

Instead of changing mod, fix the directories and file owner, like this chown -R www-data:www-data ./var