i try to make this:
<?php
error_reporting(E_ALL);
echo "<HTML><BODY>";
exec("echo Hallo > /tmp/testtt.txt", $output, $retval);
echo "Rückgabe mit Status $retval und Ausgabe:\n<br/>";
foreach($output as &$s){
echo $s."<br/>";
}
echo "</BODY></HTML>";
?>
i already tried system, passthru, exec, popen but, it never creates /tmp/testtt.txt Rights of /tmp:
drwxrwxrwt 10 root root 220K Mai 3 10:28 tmp
What is my mistake?
CodePudding user response:
Try this
exec('sh -c "echo Hallo > /tmp/testtt.txt"', $output, $retval);
CodePudding user response:
The Problem was the Sticky bit. /tmp/ has a Sticky bit - so there is a Problem with the PHP exec...