Debian and Debian-based Linux distributions such as Ubuntu now use dashes rather than bash like / bin / sh.
&> - extension of bash, dash is not known.
The correct posix-compatible way to write cmd &> file is cmd > file 2>&1
cmd > file 2>&1 works in all posix compatible shells: dash, bash, ksh, zsh, ash ...
So you need to change your code to:
exec('echo 123 > /var/log/123.log 2>&1');
source share