1

I am Using Craft CMS 5.x and the Formie plugin. Form submissions are entered into the Craft CMS queue. When I enter the control panel, the queue runs and notification mails for form submissions are sent. I want to get notification mails of form submissions automatically without logging into the control panel.

I have setup a cronjob as described here but it doesn't work. The cronjob runs without error but the notification mail requests remain in the queue. I contacted my host provider and he told that the setup is generally correct. I also run the job via CLI but nothing happens.

Here is my cronjob:

*/5 *   *   *   *   /usr/local/bin/php-head /home/okuhosan/www/v1 queue/run

I use this path to take the latest PHP version which is 8.3 rather than the default version of the host which is 8.1:

/usr/local/bin/php-head

I have installed Craft CMS in this directory. I am not sure if I have to use another subdirectory, e.g. "web":

/home/okuhosan/www/v1

Any ideas?

P.S. I have also read about this command: queue/listen. Does this mean that I wouldn't need to setup a cronjob but just run it once in CLI and the queue is observed and runs regularly? How do I stop / remove the queue/listen command once setup?

1 Answer 1

3

You're not pointing at the craft binary. In your project root directory there should be a file named craft, with no file extension (unless you've renamed it to v1?!). Point to that file and it should work:

*/5 *   *   *   *   /usr/local/bin/php-head /home/okuhosan/www/v1/craft queue/run

Personally I always set up a daemon instead that just runs listen permanently as described in the docs so that you don't have to wait for the cron job to trigger. The docs describe the process for doing that very throughly so I won't repeat it here.

1
  • That's it. When I read the documentation, I thought that /craft would be the root directory and not a file. After changing this, it works perfect. Thank you!
    – flip
    Commented May 9 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.