I'm trying to run a GAM (Google Apps Manager) command from within PHP on a Linux server. Trying exec('/home/xxx/bin/gam/gam info domain') gives return value 126 (command is found but is not executable).
I've checked that other commands run OK: exec('whoami') returns
string(6) "apache"
I've checked that user apache can run GAM commands from a shell:
$ sudo su apache
$ /home/xxx/bin/gam/gam info domain
Customer ID: Cxxxxxxxxn
Primary Domain: xxxxxxxx.ac.th
Primary Domain Verified: True
User counts as of 2022-04-26: Total Users: 4,591
For good measure, I've tried shell_exec() and system() and also exec('/usr/bin/bash /home/xxx/bin/gam/gam info domain')
For reference, I installed GAM as per these instructions by using bash <(curl -s -S -L https://git.io/install-gam)
Versions are PHP v7.4 RedHat v7.3