Zawartość pliku sudo zdaje mi sie ze jest istotny:
Kod: Zaznacz cały
Defaults env_reset
Defaults:www-data !requiretty
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
www-data ALL=NOPASSWD: /home/ts3/test1.sh
# Allow members of group sudo to execute any command after they have
# provided their password
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL
#
#includedir /etc/sudoers.d
Kod: Zaznacz cały
#!/bin/bash
mkdir /home/ts3/folder
Kod: Zaznacz cały
<?PHP
$control = Array();
exec('sudo sh /home/ts3/test1.sh 2>&1', $control);
echo 'skrypt zostal wykonany';
var_dump($control);
?>
Kod: Zaznacz cały
skrypt zostal wykonanyarray(1) { [0]=> string(53) "sudo: no tty present and no askpass program specified" }