What is the best way to write to Linux system files using PHP

We need some scripts to create configuration files for network services, such as DHCP, DNS, and Network, based on user inputs. This requires root access, but I don’t know how to run a PHP application as root. It goes through a public web interface.

+1
source share
3 answers

Awww ... granting root privileges to PHP or a web server is never a good practice, no matter how secure your setup is.

How about PHP writing modified configuration files to a temporary directory:

/home/system/transfer/apache/httpd.conf
/home/system/transfer/system/dhcp.conf
/home/system/transfer/mysql/my.ini

a sudo cron, script, ( ) ?

, Web/PHP , , .

+6

PHP script -.

+2
  • apache root.
  • -?
0

All Articles