How to fix error laravel log could not be opened in append mode.

Joseph Ajibodu
1 min readMar 20, 2022

--

This error occurs because the web server is unable to write into the error logs in the storage folder.

Since, the web server will need to be able to write all kinds of files into the storage folder and also the bootstrap/cache folder. So, we need to give the web server user write access to the storage and bootstrap/cache folders, where Laravel stores application-generated files.

sudo chown -R $USER:www-data /var/www/<your-project>/storagesudo chown -R $USER:www-data /var/www/<your-project>/bootstrap/cache

What are we doing here? We set the current user that you are logged in with as owner and the webserver user (www-data, apache, …) as the group.

Also it is advisable to set your permission as illustrated below. Do not set a directory to 777.

sudo chmod -R 775 storage
sudo chmod -R 775 bootstrap/cache

To identify your web server user and group use the following commands.

// for nginx
ps aux|grep nginx|grep -v grep
// for apache
ps aux | egrep '(apache|httpd)'

--

--

Joseph Ajibodu

A highly motivated, progress-focused Software Engineer who creates smart and scalable digital solutions for businesses and individual. [🪴 - Available to wok ]