Opendkim Command Is Not Working with Php

Opendkim Command Is Not Working with Php

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.

2

1 Answer

I can see three explanations:

  • opendkim-genkey is not found because the environment variables are not the same: use an absolute path

  • Your 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-genkey generates a key file)

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.