cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced Reporting goes to 404

Advanced Reporting goes to 404

I'm getting an error in my Magento 2.4.2-p1 when I run n98-magerun2 sys:cron:run analytics_collect_data and overnight in the cron table.

Run Magento\Analytics\Cron\CollectData::execute
Cron-job "analytics_collect_data" threw exception Magento\Framework\Exception\FileSystemException

In File.php line 226:
Directory "/tmp/analytics/tmp" cannot be created Warning!mkdir(): Permission denied

In my development environment I've set the var folder to permissions 777 and manually created the tmp/analytics/tmp folder all with permissions set to 777 but I still get the error.

2 REPLIES 2

Re: Advanced Reporting goes to 404

Hello @nasim_magento 

  1. Make sure that the user running the cron job has permission to create the directory. You can do this by changing the owner of the directory to the user running the cron job.
  2. Change the permissions on the directory so that the user running the cron job has permission to create files in it. You can do this by using the chmod command.
  3. Use a different directory for the cron job to store its files. You can specify a different directory in the cron job definition.

Here are the steps on how to change the owner of the directory:

  1. Open a terminal window.
  2. Navigate to the directory where the cron job is located.
  3. Run the following command:
chown -R <username> /tmp/analytics/tmp

Replace <username> with the name of the user running the cron job.

Here are the steps on how to change the permissions on the directory:

  1. Open a terminal window.
  2. Navigate to the directory where the cron job is located.
  3. Run the following command:
chmod -R 777 /tmp/analytics/tmp
Here are the steps on how to specify a different directory for the cron job to store its files:
  1. Open the cron job definition file.
  2. Find the line that starts with analytics_collect_data.
  3. Add the following option to the line:
--directory=/path/to/new/directory

Replace /path/to/new/directory with the path to the new directory you want to use.

Once you have made the necessary changes, restart the cron job. The cron job should now be able to create the directory and store its files without any errors.

 
 
Was my answer helpful? You can accept it as a solution.
200+ Premium Magento 2 Extensions Need help? Hire Magento Developer

Re: Advanced Reporting goes to 404

How to navigate to the directory where the cron job is located?