Php Slim 3.1 ubuntu服务器错误

Php Slim 3.1 ubuntu服务器错误,php,ubuntu,slim,Php,Ubuntu,Slim,将Slim 3应用程序部署到Ubuntu服务器时收到以下服务器错误 Slim Application Error The application could not run because of the following error: Details Type: UnexpectedValueException Message: The stream or file "/var/www/html/api/search- api/src/../logs/app.log" could not

将Slim 3应用程序部署到Ubuntu服务器时收到以下服务器错误

Slim Application Error
The application could not run because of the following error:

Details

Type: UnexpectedValueException
Message: The stream or file "/var/www/html/api/search-
api/src/../logs/app.log" could not be opened: failed to open 
stream:Permission denied
File: /var/www/html/api/search-
api/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php
Line: 107

我将日志目录的权限设置为可写,但仍不工作。

web服务器用户仍无法写入
/var/www/html/api/search api/src/logs
中的日志目录

尝试:

这假设您的web服务器以
www-data
用户的身份运行,该用户组名为
www-data

cd var/www/html/api/search-api/src/
sudo chgrp -R www-data logs
sudo chmod -R g+rws logs