Automated Tasks Error - Failed to open stream: Permission denied

Hello community!

Concrete Version: 9.1.0
PHP Version: 7.4.30

I followed the instructions in the official documentation to set up an automated task for sitemap generation.

First part of the process was setting up the cron:

* * * * * /path/to/public/concrete/bin/concrete concrete:scheduler:run >> /dev/null 2>&1

I then added the following expression:

0 0 * * *

Now, when I try to access tasks via the dashboard, I am getting the following error:

/application/files/cache/expensive/0fea6a13c52b4d47/25368f24b045ca84/38a865804f8fdcb6/57cd99682e939275/2ddb27c5cdf0b672/745d4c64665be841/dc4f6a3c82dec34b/a7e4acc6325bbadb.php): failed to open stream: Permission denied

It seems to be related to line 46 of /concrete/src/Cache/Driver/FileSystemStashDriver.php

$result = file_put_contents($path, $storeString, LOCK_EX);

I’m no developer, but I would be inclined to guess this was some kind of permissions issue.

However, I’m not really sure how to fix this.

Any advice is appreciated!

1 Like

I have resolved this issue. I will post the solution, as it may help others.

The fix was to change ownership of where the old root cron had written files.

Hello - I am having this exact same issue - could you post your fix if possible please?

Thanks!

The solution is to run /path/to/public/concrete/bin/concrete with the same user as the webserver.

If the user impersonated by the webserver is www-data, you can simply use

sudo -u www-data /path/to/public/concrete/bin/concrete

instead of

/path/to/public/concrete/bin/concrete

Thank you @ mlocati

Annoyingly, that does not work for me, the scheduler does not run. I expect it is going to be a syntax error on my part, but I am just not able to work it out.

I have since started another post about the issue I am experiencing here: