ostark/craft-async-queue

Commerce emails not being added to queue

Closed this issue · 8 comments

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

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

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)

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.

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

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.

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?

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

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

Thanks for your help!