S
S
Sinot2016-03-02 16:25:13
PHP
Sinot, 2016-03-02 16:25:13

How to run selected php script as root in Nginx?

Greetings.
There is a script (based on this one ) that checks the availability of the server by means of a ping. But the problem is that the script uses RAW sockets, which is only allowed by root.
This is the question, how to configure Nginx so that a specific script runs as root? By itself, Nginx runs on behalf of a user created specifically for it.
Thank you.
PS Actually, the task is to check the availability of the selected server and it is not necessary to solve it in this way, but calling system programs from php (they offered system("ping ".$_GET[adres]) and the like) seemed to me not very reasonable.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Knyazev, 2016-03-02
@Sinot

The point here is not who nginx is running under, as I understand it, but who php is running under. If you are using php-fpm, then you can create a separate pool under root, on a separate port or socket, and bind location in nginx to it. Google something like "multiple PHP-FPM pools", for example .

A
Andrey, 2016-03-02
@VladimirAndreev

why is this perversion?
write a script, put it in cron for root and you will be happy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question