PHP-скрипт (restore.php):
var_dump( get_current_user());
var_dump( shell_exec( " cp /var/www/bkp/* /var/www/html 2>&1 " ));
При доступе к скрипту в браузере:
string(6) "apache"
string(115) "cp: cannot create regular file `/var/www/html/227.png': Permission denied cp: cannot remove `/var/www/html/234.png' Permission denied "
Консоль:
cd /var/www/html
sudo -u apache touch test.txt
ls test.txt
-> test.txt
sudo -u rm 234.png -f
ls 234.png
-> ls: 234.png: No such file or directory
sudo -u apache php restore.php
ls 234.png
-> 234.png
Может кто-нибудь объяснить, почему у меня возникают проблемы с правами в моем php-скрипте при запуске в браузере?