'Reindex Content' Task Error - Failed to open stream: Permission denied

Hi,

I am having an issue with the automated running of the ‘Reindex Content’ task…

  • The server is nginx on Ubuntu 22.04.3
  • Concrete v 9.3.2
  • PHP 8.2

I have set up the task scheduler, and that is running fine every minute - It runs other jobs fine - eg. Create Sitemap, Clear cache, etc.

This is the scheduler cron:

* * * * * /usr/bin/php8.2 -q /path/to/concrete/bin/concrete concrete:scheduler:run >> /dev/null 2>&1

With the ‘Reindex Content’ task it creates the cache directories/files with ‘root’ ownership/permissions, but it needs to be set as ‘www-data’.

So we get exceptions e.g.:

Exception Occurred: /path/to/concrete/src/Cache/Driver/FileSystemStashDriver.php:40 touch(): Unable to create file /path/to/application/files/cache/overrides/1952a01898073d1e/561b9b4f2e42cbd7/38a865804f8fdcb6/57cd99682e939275/e56c038d63394797/2de43d2a2b4d5ff5.php because Permission denied (2)

I have tried:

====

1 - Adding the www-data user to the scheduler - eg:

* * * * * sudo -u www-data /usr/bin/php8.2 -q /path/to/concrete/bin/concrete concrete:scheduler:run >> /dev/null 2>&1

Amongst a whole bunch of other variations on this - none of them run at all, only the example given above seems to run.

====

2 - Setting up the scheduler cron for www-data - using:

sudo crontab -u www-data -e

But the scheduler does not run then either.

====

I have set this up several other times on Apache servers with no problems, and so I expect this is simply a syntax issue, but I am not having any joy after much trying - any suggestions would be great.

Thanks all.

Does sound like a permissions issue. is the user where the files live part of the www-data group?

Thanks for response Myq

Yes, can confirm it is.

Yeah still seems like a permissions issue - are the perms on the files directory 755? I think some of that is covered in this doc here:

But yeah definitely seems like it’s still server-permissions-related.

Thanks @EvanCooper - Yes, can confirm that the permissions are set to 755.