Anagio
Anagio

Reputation: 3075

Is this the right entry for the sudoers file to give php access to reload nginx?

I need to give php access to reload nginx. The command is nginx -s reload so is the entry in the sudoers file below correct?

www-data ALL=NOPASSWD: nginx -s reload

Then would <?php exec('sudo nginx -s reload'); ?> or shell_exec be the function to use?

Thanks

Upvotes: 2

Views: 1405

Answers (1)

Grexis
Grexis

Reputation: 1512

I would use the absolute path to nginx, but your syntax looks correct. You would use shell_exec()

Upvotes: 1

Related Questions