F
F
fomiash2020-04-29 01:23:05
PHP
fomiash, 2020-04-29 01:23:05

How to determine the name of the web server in PHP?

Greetings! You need to prompt the user with a console command to elevate the rights for the web server (current name).
1) The web server requests the file
2) Using PHP: If the permissions on the file prevent the web server from writing, issue the command
For example web server (Apache) "_www:_www" on Linux
Displayed: sudo chown -R _www:_www /path/ to/ file

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2020-04-29
@xmoonlight

shell_exec("ps aux | egrep '(apache|httpd)'");

shell_exec("ps -ef | egrep '(httpd|apache2|apache)' | grep -v `whoami` | grep -v root | head -n1 | awk '{print $1}'");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question