from PHP I can run commands with shell_exec but can't run bash files
I run this command
sudo ls /var/www/
and i get results
/var/www/1.sh
/var/www/2.sh
/var/www/3.sh
but when I run this command nothing happens
$output = shell_exec('sudo sh /var/www/1.sh > /dev/null 2>&1');
echo "<pre>$output</pre>";
In 1.sh i added this code
#!/bin/bash
/usr/bin/echo "test" > TEST1.txt
it works when i type in terminal ./1.sh so only from php is not working
Server: centos from PHP I think I have root premission to execute commands
this will fix ur problem
$output = shell_exec('sudo /usr/bin/sh /var/www/1.sh > /dev/null 2>&1');