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

Čamo's avatar
Level 3

How to set Laravel to generate files with required permissions

I have a deploy BASH script which runs as Jenkins CI job. It runs under the jenkins user. Deploy needs to delete old directory and replace it with new one. But there is a problem. Laravel generates the files like session or cache with chmod 644 as www-data user. It means although Jenkins is in the www-data group he can not delete the generated files cause group has only read permission.

The question is is there a way to force Laravel or PHP demon to generate files with required permissions e.g. 664? Hope it is. Thanks for any help.

0 likes
2 replies
Čamo's avatar
Level 3

I can not use it on generated files like cache or session. The point is to delete session files and cache files on deploy. Not in the framework run.

Please or to participate in this conversation.