Php calls the svnup. php file of the shell script :? Set_time_limit (0); $ outputarray (); $ ret0; exec (usrbinsudodata0shellsvnvp. sh, $ output, $ ret); echoResult: {$ ret}; print_r ($ output );? Data0shellsvnvp. sh is an updated script. The main content is sv.
PhpThe content of the svnup. php file that calls the shell script:
Set_Time_ Limit (0 );
// $ Output = array ();
$ Ret = 0;
ExEc ("/usr/bin/SuDo/data0/shell/svnvp. sh ", $ output, $ ret );
Echo "Result: {$ ret }";
Print_r ($ output );
?>
/Data0/shell/svnvp. sh is an update script. The main content is svn up.
You also need to modify the sudo configuration file, such as mongodoCommandEdit the configuration file:
1. Comment Defaults requiretty
Defaults requiretty is changed to # Defaults requiretty, indicating that the terminal does not need to be controlled.
Otherwise sudo: sorry, you must have a tty to run sudo
2. Add Defaults visib1_w
Otherwise, sudo: no tty present and no askpass program specifi will appear.Ed
I found that sudo-1.6.9p17-5.el5 does not support this parameter, sudo-1.7.2p1-10.el5 supports.
3. Grant the www user the svn execution permission
For example, add www ALL = (ALL) NOPASSWD:/data0/shell/svnvp. sh
Note: NOPASSWD eliminates the need to enter the password of the www user during command execution.
Www users are nginx or apache running users
4. Restart nginx or apache to allow users to regain permissions.