Answer the question
In order to leave comments, you need to log in
How to restart nginx via php on debian?
I have a command in php script that should reload nginx config:
var_dump(exec("/usr/local/nginx/sbin/nginx -s reload 2>&1"));
string(85) "2017/08/14 08:32:36 [alert] 7919#0: kill(7676, 1) failed (1: Operation not permitted)"
Answer the question
In order to leave comments, you need to log in
All right, I got it.
My script was run under a user who has no rights (www-data).
In order for the script to run, I installed the sudo module and added the line in its config (visudo): www-data ALL=NOPASSWD: ALL
Before the command itself, I now attribute sudo -S
and it works.
Translation: operation is not allowed.
Maybe not enough rights?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question