Using PHP to execute terminal commands
问题 How can PHP be used to create a number of commands in the terminal? For example, if I want to change the permissions on a folder or a file, I might run Sudo Chmod 777 FileName from the command line. How could I do this with PHP? 回答1: Look at exec , system etc: http://www.php.net/manual/en/book.exec.php Obviously, if you are going to use sudo for root access stuff (not recommended) then you would need to either supply a password somehow or set the user which PHP is running as to not require a