I am running this command opendkim-genkey --domain=example.com --selector=example --subdomains on Linux terminal, It is working properly, but when I try to run this in my PHP page like
shell_exec("opendkim-genkey --domain=example.com --selector=example --subdomains");
this is not working..
I also try to run another command in my php page, and I get result of them.
1 Answer
I can see three explanations:
opendkim-genkeyis not found because the environment variables are not the same: use an absolute pathYour Apache (or other webserver) user does not have permission to execute this command: you can use sudo, see
And as @rups suggested, your user may need write permission (if
opendkim-genkeygenerates a key file)