note 50777 deleted from function.shell-exec by cmb
| From: | cmb@php.net | Date: | Sun, 14 Jul 2019 11:31:18 +0000 |
| Subject: | note 50777 deleted from function.shell-exec by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211582@lists.php.net to get a copy of this message | ||
Note Submitter: Kenneth
----
Sometimes it's needed to be able to execute shell commands as root using PHP. For instance,
restarting named after adding or changing zones, or adding new alliases for sendmail.
My approach is to run a server called Nanoweb, available from http://nanoweb.si.kz/. It's a webserver written in PHP, and
needs only the pcntl extension extra to operate. Nanoweb is configured to only listen for
connections on localhost, port 81 for example. From my normal PHP scripts running inside Apache I
simply call scripts in Nanoweb to get the messy 'root' tasks done. Much more secure and
safer.
Hope this helps