passwd apache
任意のパスワードを入力
yum -y install sudo
visudo
下記のように編集する。
apache ALL=(ALL) ALL
#Defaults requiretty
PHPの実装は下記のようにする。
$command = "echo 'パスワード' | sudo -S sh test.sh";
shell_exec($command);
これで、test.sh をroot権限にて実行することが可能となる。
Go to list of users who liked
More than 5 years have passed since last update.
passwd apache
任意のパスワードを入力
yum -y install sudo
visudo
下記のように編集する。
apache ALL=(ALL) ALL
#Defaults requiretty
PHPの実装は下記のようにする。
$command = "echo 'パスワード' | sudo -S sh test.sh";
shell_exec($command);
これで、test.sh をroot権限にて実行することが可能となる。
Register as a new user and use Qiita more conveniently
Go to list of users who liked