Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GrantMeFood's avatar

Permission Denied on storage/logs when deployed to rhel/apache instance

I'm super stumped here after spending several hours troubleshooting.

I have a Laravel 11 app that I'm moving from a Centos 7 box to a RHEL EC2 instance. In both cases, the app is served by apache/httpd. When I hit the instance IP (which is temporarily exposed publicly), I get a Laravel error page that says:

The stream or file "/var/www/${REPO_NAME}/storage/logs/laravel-2024-07-09.log" could not be opened in append mode: Failed to open stream: Permission denied

The message generally repeats, though at the bottom of the stack I have an exception about trying to write to a session file (this is configured to use file based sessions right now, but I am going to change that).

The entire repo is owned by the apache user and group on this instance and I have done a chmod -R 755 on the entire repo (I started off doing this only to the storage directory recursively). I'm at a loss here. httpd is running as apache:apache as well.

The apache config is pretty straightforward with a single virtual host on port 80 (SSL is handled upstream by a network load balancer) with the document root pointing at the public folder in the Laravel repo.

Anyone have any suggestion for things I may be missing here?

0 likes
4 replies
Snapey's avatar

What permission and ownership does the log file have?

GrantMeFood's avatar

Same as the parent repo directory, owned by apache with 755 permissions. I've even tired 777 (just for giggles) to no avail.

GrantMeFood's avatar

I should also note that the file its trying to access doesnt exist, so I would imagine that it should get created. We havent changed any of the log config settings for Laravel that enabled this to work just fine in the past.

Please or to participate in this conversation.