CircleCI and shell_exec user mismatch

When commands are run, they are with the user circleci. However, in my PHP application I am trying to execute a command line command, but the package I have installed is not working when executed via shell_exec(). This is because the user then switches over to www-data whenever a command is executed via exec or shell_exec.

Is there any way around this? Things work locally, but when they are built in the CircleCI environment my application doesn’t work properly because of the user mismatch.

I’ve also tried switching over to the circleci user before executing the command via exec, but I get an entirely different error.

sudo -u circleci wp --info
Sorry, user circleci is not allowed to execute '/usr/local/bin/wp --info' as circleci on 543e6b7ffaf4.