ostark / craft-async-queue

Async Queue Handler for Craft 3 and 4
MIT License
93 stars 7 forks source link

Commerce emails not being added to queue #39

Closed petehjfd closed 3 years ago

petehjfd commented 3 years ago

Hi

We've just installed the AsyncQueue plugin. It works fine locally, but on our staging server Commerce emails are not being added to the queue. The AsyncQueue test does add jobs to the queue, but they don't get processed.

There's nothing in the logs. The queue log is showing no new activity since the plugin was installed.

My initial thought is that it might be a permissions issue. Could you elaborate on the "Permissions to execute a php binary" requirement? How would I check if my server has the necessary permissions enabled?

Craft 3.6.6 AsyncQueue 2.2.0 PHP 7.4

Thanks

ostark commented 3 years ago

The plugin relies on the php binary. If it's not in the default location you can configure the path via env var: https://github.com/ostark/craft-async-queue#configuration-optional

to get the location on the server try

which php
petehjfd commented 3 years ago

The PHP binary on the server is at /usr/bin/php. There are actually multiple versions of PHP on the server, so I also tried:

PHP_BINARY="/usr/bin/php7.4"

but that resulted in the following error when going to /admin/utilities/async-queue-test:

is_executable(): open_basedir restriction in effect. File(/usr/bin/php7.4) is not within the allowed path(s): (/home/storm/sites/mysite-co-uk/:/home/storm/tmp/mysite-co-uk:/tmp)
ostark commented 3 years ago

most common paths are

/opt/php-7.4/bin/php
/opt/php/7.4/bin/php

just browse your directory structure to find it out.

petehjfd commented 3 years ago

I know where the PHP binary is, that's not the issue. My question is regarding the "Permissions to execute a php binary" requirement. Please can you explain in more detail what you mean by that?

The plugin is not logging any errors so it's difficult to diagnose the problem.

Thanks

ostark commented 3 years ago

this is not the path to the binary

PHP_BINARY="/usr/bin/php7.4

Since you don't hit PHP, there is not PHP error.

petehjfd commented 3 years ago

Sorry, I'm not sure what you mean. That is the path to my PHP binary. My server has multiple PHP versions, so both /usr/bin/php and /usr/bin/php7.4 exist. /usr/bin/php is aliased to /usr/bin/php7.1.

But if I don't specify a binary in the env file, the plugin appears to half work. Commerce emails are not queued, but AsyncQueue test jobs are queued. If it wasn't able to find the PHP binary at all, surely it wouldn't be able to add the test jobs to the queue?

ostark commented 3 years ago

Fine if it is an actual file.

If it wasn't able to find the PHP binary at all, surely it wouldn't be able to add the test jobs to the queue?

No, this happens before (usually with php-fpm) during the HTTP request.

Edit the open_basedir restriction on your host, add the path there. https://stackoverflow.com/questions/1846882/open-basedir-restriction-in-effect-file-is-not-within-the-allowed-paths

petehjfd commented 3 years ago

I added /usr/bin to the open_basedir directive and everything is now working.

Thanks for your help!